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