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