I have different database with same schema. I need to connect to one of them according to the client that has been connected. For example if ClientA is connected i must connect to DatabaseA; If ClientB is connected i must connect to DatabaseB; Now I have a multi-layered application: a Presentation Layer, a Service Layer and a repository Layer. With some logic I obtain the correct connection string!
So.. What I need now.
I don't know where to store the connection string for that client! I was thinking in Session. But if I store it in the session I have to pass it in each call I do to the repository layer, because Session is not visible at repository. I think this is the worst solution I could take.
I would like to have the selected connection string just a repository layer in a global variable for that client.
Suggestion? Thank you
If you want to keep global data for web site - you are able to store any data in Application class, more details you can check by the following link: http://www.asp.net/web-forms/overview/data-access/caching-data/caching-data-at-application-startup-cs In case when you have any separate parts of application , you are able to keep shared data in the xml file and Create ConfigManager in each application domain or you can use database table.