public void Dispose() { if (TenantServices != null) { TenantServices.Dispose(); TenantServices = null; } }
public async ValueTask DisposeAsync() { if (TenantServices != null) { await TenantServices.DisposeAsync(); TenantServices = null; } }
partial void ConfigureServicesPartial(IServiceCollection services) { services.AddTransient(sp => // HACK: ITemplateRenderer must be visible for singleton services (like IMailSenderService) residing in the root container // but unfortunately, we cannot register it in the root container. If we did so, we would also need to add the Razor view engine services // in the root container which would bring along routing services. We cannot allow this as it would completely mess up routing. // So we register ITemplateRenderer in the UI tenant container (being an MVC app, it adds a Razor view engine anyway) // and add this fake registration which delegates the service resolution to the UI tenant container. // This is an ugly trick but we cannot do much better. It's not something very risky though since ITemplateRenderer is a transient service and // the root container and tenant containers have the same lifetime. sp.GetRequiredService <Tenants>()[UITenantId] !.TenantServices.GetRequiredService <ITemplateRenderer>()); }
public Sharding(string generalDbName, string connectionString, UniversalServices universalServices, TenantServices tenantServices) { try { _tenantRepo = tenantServices; _universalRepo = universalServices; ShardMapManager shardMapManager; ListShardMap <int> sm; } catch (Exception exception) { Trace.TraceError(exception.Message, "Error in sharding utilties initialization."); } }