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