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