title: Dynamically connect to different databases in a hybrid multitenant solution
body: <p>I was researching about multi-tenancy and multi-instance approaches and chose a hybrid.</p>
  
  <p>I keep a single instance of my ASP.Net MVC 2 application but clone the database structure for each client. I am using LINQ to SQL.</p>
  
  <p>Right now, I have one instance of both so just a single connection string is working.</p>
  
  <p>I am planning to expand it for many clients.</p>
  
  <p>I can write code to create a clone of the database structure, create a db user and give permissions whenever a new client signs up. I also will save all these details (db name, db user, allowed app users) in a table.</p>
  
  <p>But how can I make the app use a different database based on who is logged in?</p>
  
  <p>I can't even figure out the approach I should take to do this. Should I programmatically add connection string to web.config? Is there another way to do this?</p>