I created a EDMX file from DB:
internal partial class LocalBDD : DbContext
{
public LocalBDD() : base("name=LocalBDD")
{
}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
throw new UnintentionalCodeFirstException();
}
public virtual DbSet<C__RefactorLog> C__RefactorLog { get; set; }
}
If I store the connection string in App.config, this works fine, but I need to encrypt the sensitive info, I'm trying to change the connection from my context in this way:
LocalBDD _localBDD;
_localBDD = new LocalBDD("my new connStr");
But I get
LocalBDD does not contain a constructor that takes 1 arguments
This code it's generated by the ADO.NET Entity Data Model Assitant, and if I edit it for add a constructor which takes 1 argument, when the project recompile the changes will be lose.
How I can change the connection string of my DbContext at runtime?
Thanks in advance