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