public MyProjDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <MyProjDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); MyProjDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MyProjConsts.ConnectionStringName)); return(new MyProjDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <MyProjDbContext>(options => { if (options.ExistingConnection != null) { MyProjDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { MyProjDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }