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