CslaDataPortalUrl

CslaDataPortalUrl

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


Barreto posted on Tuesday, September 04, 2007

I have 2 libraries dll that have build-in access to its own remote portal. Let's called Library 'A' and Library 'B'.

Each library must be a different CslaDataPortalUrl and both libraries will work together in my main application.

I tried to configure it in runtime inside of each library's constructor, like that:

Library A:
ConfigurationManager.AppSettings["CslaDataPortalUrl"] = "http://www.mydomain1.com/Portal-A/remotingportal.rem";

Library B:
ConfigurationManager.AppSettings["CslaDataPortalUrl"] = "http://www.mydomain2.com/Portal-B/remotingportal.rem";

But ConfigurationManager is a Domain Application Configuration then Library 'B' configuration overwrites Library 'A' configuration.

Is there a way to do that?
Any help would very appreciated.
Thanks.
Jaime Barreto

RockfordLhotka replied on Tuesday, September 04, 2007

You'll need to write your own custom data portal proxy to allow for more flexible configuration.

The problem goes deeper than just that the config settings are per-AppDomain. Within the data portal itself, the proxy object is also per-AppDomain.

So the only answer is to create your own variation on RemotingProxy (copy the code into your project and alter it there to avoid changing CSLA itself).

This concept has been discussed in numerous other threads - search for custom data portal proxy and you'll probably find most of them.

JustinJones replied on Wednesday, September 05, 2007

I haven't actually tried this, but we had a similar problem and looked into this as a possible answer.  If Library A and B constitute different modules of the application, you can also place one in a separate AppDomain.  The second AppDomain should have it's own App.Config where you can place the url for it's classes.

Justin.

Copyright (c) Marimer LLC