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