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