fix factory

This commit is contained in:
LORENZO\pacio 2025-03-24 14:35:00 +01:00
parent 386b5faafa
commit c4915394ae

View File

@ -14,8 +14,8 @@ public class TenantDbContextFactory : ITenantDbContextFactory
public ITenantDbContext GetDbContext(string tenant) public ITenantDbContext GetDbContext(string tenant)
{ {
// Create a scope to resolve DbContext // Create a scope to resolve DbContext
using (var scope = _serviceProvider.CreateScope()) var scope = _serviceProvider.CreateScope();
{
return tenant switch return tenant switch
{ {
Clienti.Maras => scope.ServiceProvider.GetRequiredService<Maras_DbContext>(), Clienti.Maras => scope.ServiceProvider.GetRequiredService<Maras_DbContext>(),
@ -25,5 +25,4 @@ public class TenantDbContextFactory : ITenantDbContextFactory
_ => throw new KeyNotFoundException($"No DbContext found for tenant: {tenant}") _ => throw new KeyNotFoundException($"No DbContext found for tenant: {tenant}")
}; };
} }
}
} }