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