 <p>Simplest possible solution is to put user entered key in some global variable(or somewhere where you can access it later) and just call a method to instantiate your DbContext with correct connection string. Something like this:</p> <pre><code>public MyDbContext CreateContext() { if (user_entered_key == "one") { return new MyDbContext("Db1DbContext"); } else if (user_entered_key == "two") { return new MyDbContext("Db2DbContext"); } else { return new MyDbContext("Db3DbContext"); } } </code></pre>