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