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