linq to sql - Specify ConnectionString for MVC DataContext globally -


i have mvc3 application allows user choose database want use on initial login. various connection strings available in web.config every datacontext use chosen connection.

i aware can supply parameter 1 instance of named datacontext this:

mydatacontext db = new mydatacontext(connectionstring); 

or can override oncreated event instances of named datacontext

public partial class mydatacontext {     partial void oncreated()     {         connections connections = new connections();         this.connection.connectionstring = connections.getcurrentconnectionstring();     } } 

how instances of datacontexts throughout application?


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -