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