public SbsAbpDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <SbsAbpDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: false); SbsAbpDbContextConfigurer.Configure(builder, configuration.GetConnectionString(SbsAbpConsts.ConnectionStringName)); var dbContext = new SbsAbpDbContext(builder.Options); //dbContext.SuppressAutoSetTenantId = true; return(dbContext); }
public override void PreInitialize() { Configuration.Modules.AbpEfCore().AddDbContext <SbsAbpDbContext>(options => { if (options.ExistingConnection != null) { SbsAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { SbsAbpDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); }