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