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