public AccountingDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <AccountingDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); AccountingDbContextConfigurer.Configure(builder, configuration.GetConnectionString(DemoConsts.ConnectionStringAccountingDbContext)); return(new AccountingDbContext(builder.Options)); }
public override void PreInitialize() { Configuration.ReplaceService <IEfCoreTransactionStrategy, DbContextEfCoreTransactionStrategy>(DependencyLifeStyle.Transient); if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <AccountingDbContext>(options => { AccountingDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); //if (options.ExistingConnection != null) //{ // NewCommDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); //} //else //{ //} }); } }