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