I have 2 SQL Server 2008 R2 databases (SQLEXPRESS): database1 and database2
ConnectionString (ADO.net) should contain databaseName1 When User is User1
ConnectionString (ADO.net) should contain databaseName2 When User is User2
To manipulate data, I use the same EF model for both
Using compiled MVC 3 Application, I would like to switch between databases at runtime,
also for security reasons, I should avoid putting connection string in web.config
Please, if any advise, for how to do that
Many Thanks.
Why can’t you put the connecting string in web.config? It is more secure to have it there than in your source code unencrypted. Read here about how you encrypt your config: http://chiragrdarji.wordpress.com/2008/08/11/how-to-encrypt-connection-string-in-webconfig/
If you worry about that kind of security you might have other problems.