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