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