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