How change connection string runtime in ef core?
Posted: Fri 18 Aug 2017 05:58
Hi
How change connection string runtime in ef core?
I try to change connection string on runtime but data no change.
Please help me.
How change connection string runtime in ef core?
I try to change connection string on runtime but data no change.
Code: Select all
public string ConnectionString { get; set; }
public EFDbContext() :
base()
{
OnCreated();
}
public EFDbContext(DbContextOptions<EFDbContext> options) :
base(options)
{
OnCreated();
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseMySql(ConnectionString);
CustomizeConfiguration(ref optionsBuilder);
base.OnConfiguring(optionsBuilder);
}
Please help me.