The way that it auto-generates the classes, it doesn't take a connection string as a parameter - although the generates code passes one to the base class. I can edited the template myself, but isn't there a better way, as I may regenerate the model (maybe even delete & re-create) and I don't want it to affect the template.
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated from a template.
//
// Manual changes to this file may cause unexpected behavior in your application.
// Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
public partial class MyEntities : DbContext
{
public MyEntities()
: base("<Connection string>")
{
}
...
I am using a DB first approach. It all works fine but now I've created an exact copy of the database and I need to be able to switch between the two.