1

Using VS 2010, I have created a simple dynamic data entities web application (using the template provided in VS 2010). It works fine. However, I want to change the "InitialCatalog" in the model connection string at runtime, via a user selection. I know how to create the new connection string, but I don't know how to update the entity model with the new string. It is possible to update the model to use the new connection string at runtime, and if so, how?

1 Answers1

0

on how you are using Entity Framework, this can be done by using the overloaded constructor for context to provide your own connection string.

e.g

using(var Context = new Context("my connection string")
{
    // Do some stuff with your context.
}

There is a very similar post here.

Community
  • 1
  • 1
Dave Williams
  • 2,166
  • 19
  • 25