Monday, 15 August 2011

c# - Multi-database connection string: where store it in my application -


I have separate databases with the same schema I have to connect to customers who are connected. For example, if ClientA is connected, then I should be connected to DatabaseA; If Clientb is connected, then I should be connected to database; Now I have a multi-level application: a presentation layer, a service layer and a repository layer. With some arguments, I get the correct connection string!

So .. what do I need now?

I do not know where the connection string for that client will be stored! I was thinking in the session. But if I store it in session then I have to pass it in every call which I can do on the repository layer, because the session is not visible in the repository. I think this is the worst solution I could take.

I have to place only one repository layer in the global variable for that customer string selected.

Suggestions? If you want to keep global data for a web site - then you are able to store any data in

< P> Application class, more details which you can check with the following link: If you have a separate part of the application, you can keep the shared data in the XML file and make the configuration manager in each application domain or you can use the database table Are there. / P>

No comments:

Post a Comment