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