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