Shared Object with Shared Variables using .NET Remoting?

Shared Object with Shared Variables using .NET Remoting?

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


brembot posted on Wednesday, November 29, 2006

Hello All,

I'm creating a shared class with shared varible (ConnectiionString) in it. The purpose is to change my ConnectionString at runtime without relying on the application configuration file. I used my shared class in my business layer to get the ConnectionString. It works fine if you don't use .NET Remoting but if used the problem will occur and my ConnectionString value is gone. Shared variables in .NET Remoting don't have sense anymore because the it will create a new object instead of using the existing one object which shared.

Any ideas?

Thanks

hurcane replied on Wednesday, November 29, 2006

My project also avoids the configuration file because our user base needs the ability to select the database at run-time, yet use the same application server.

We use a custom business principal and put a connection string property in the business principal. The Login method includes the database connection string. This works very well for us because the business principal is automatically carried to the server through the data portal.


JoeFallon1 replied on Thursday, November 30, 2006

In CSLA 2.x you can also use ClientContext or GlobalContext to pass values to the Server. (Global also brings them back to the client.)

So you can pass in data like a connection string to use and it will be available on the other end of the remoting channel.

Joe

 

brembot replied on Friday, December 01, 2006

Hello Joe,

Is it possible if we create our own class and copy the implementation of ClientContext or Global Context instead of using the Csla? What can you recommend, ClientContext or GlobalContext?

Thanks,
Marlon

Copyright (c) Marimer LLC