Why DataPortal is static ?

Why DataPortal is static ?

Old forum URL: forums.lhotka.net/forums/t/8537.aspx

Alex Ilyin posted on Tuesday, February 16, 2010

I'm just starting learning CSLA but there is one thing I just can not understand - Why DataPortal class has been made static ? If I implement some application module using CSLA and somebody else implements another module with CSLA are we going to conflict ?

ajj3085 replied on Tuesday, February 16, 2010

If your modules are all part of the same application, I would think they should all share the same data portal configuration, and they shouldn't conflict... but I'm not sure what kind of conflict you're concerned about.

As far as static goes... I'm not sure what you'd gain by having it as an instance, especially when you then need to worry about thread safety. 

Alex Ilyin replied on Tuesday, February 16, 2010

Thank you for the answer. I understand that if so many users successfully use CSLA then problem I am talking should have solution. Let me explain scenario I am interested in - my application consumes data from several dataBase servers. For example, dataBase A stores Orders and dataBase B stores Users, they know nothing about each other. I want Order Objects to be transparently persisted at Server A and Users to be transparently persisted at Server B, but I can specify just one "WcfDataPortal" endpoint in configuration. 

      <endpoint name="WcfDataPortal"
                contract="Csla.Server.Hosts.IWcfPortal" />

So I have to choose will it be http://ServerA.com/WcfPortal.svc or http://ServerB.com/WcfPortal.svc. I am almost sure that I just do not understand something, so if you explain me how this issue can be resolved I'll be very grateful.

RockfordLhotka replied on Tuesday, February 16, 2010

You can read the item on multiple data portal server configurations in the FAQ, that might help. This is most certainly a frequently asked question in one form or another.



Alex Ilyin replied on Wednesday, February 17, 2010

Thank you for the answer, I should have looked at that FAQ myself before asking the question.

Copyright (c) Marimer LLC