Multidatabase

Multidatabase

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


phucphlq posted on Friday, July 21, 2006

I have a client application, a windows service and 2 similar databases(is named A, B).

When client choose database A, service will use database A to access data.

When client choose database B, service will use database B to access data.

RockfordLhotka replied on Friday, July 21, 2006

I would recommend keeping the actual database connection strings on the server, and having the client pass a "database name" to the server.

You can use ApplicationContext.ClientContext for this purpose. After you've asked the user which database to use (or read it from the client config file or whatever), put that database name into ClientContext. That value will automatically be available on the server thanks to the data portal.

Then in your server-side data access code you can get the connection string for the database name in ClientContext and talk to that database.

Copyright (c) Marimer LLC