builder.Services.AddDbContextFactory<TenantAppContext>((sp, option) =>
{
var tenantHelper = sp.GetRequiredService<ITenantHelper>();
var tenantConnectionString = tenantHelper.GetTenantConnectionString();
if (tenant != null)
{
option.UseSqlServer(tenantConnectionString);
}
});
builder.Services.AddDbContextFactory<TenantAppContext>((sp, option) =>
{
var tenantHelper = sp.GetRequiredService<ITenantHelper>();
var tenantConnectionString = tenantHelper.GetTenantConnectionString();
if (tenant != null)
{
option.UseSqlServer(tenantConnectionString);
}
});