This commit is contained in:
Marco Audiffredi 2025-03-24 14:36:42 +01:00
commit 52eb48f3fe
2 changed files with 10 additions and 11 deletions

2
.gitignore vendored
View File

@ -361,6 +361,6 @@ MigrationBackup/
# Fody - auto-generated XML schema
FodyWeavers.xsd
/.vs/ApiPolo/DesignTimeBuild/.dtbcache.v2
/.vs/ApiPolo/v17/.suo
/.vs/ApiPolo/v17/.futdcache.v2
/.vs/ApiPolo/DesignTimeBuild/.dtbcache.v2

View File

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