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