ENV: VS 2019, C# .NET Framework 4.6.1
I'm using a .json
file to hold all my configurations:
IConfigurationBuilder config = new ConfigurationBuilder();
config.AddJsonFile("autofac.json");
My question is, how do I include the DbContext
in this file? I'm adding Autofac to an existing application and using it in a new section. This is what the code looks like (change the real name to "My*" to protect the innocent) in the original code:
public partial class MyDbContext : DbContext, IDisposable
{
public MyDbContext () : base("MyDB")
{}
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{}
}
Is it possible to relate the DbContext
concrete class to an existing interface (does one exist) or should I create a wrapper around it and then create a corresponding interface for the wrapper class?