public TenantService(MultiTenantContext multiTenantContext, ITenantResolutionStrategy tenantResolutionStrategy,
                      IOptions <AppSettings> appSettings)
 {
     _tenantResolutionStrategy = tenantResolutionStrategy;
     _multiTenantContext       = multiTenantContext;
     _appSettings = appSettings.Value;
 }
Esempio n. 2
0
        public static void AddMultiTenancy(
            this IServiceCollection serviceCollection,
            IEnumerable <ITenant> tenants,
            ITenantResolutionStrategy tenantResolutionStrategy = null)
        {
            serviceCollection.AddHttpContextAccessor();
            serviceCollection.AddSingleton(tenants);
            serviceCollection.AddSingleton(serviceCollection);
            serviceCollection.AddSingleton <ContainerBuilder>();

            if (tenantResolutionStrategy == null)
            {
                serviceCollection.AddScoped <ITenantResolutionStrategy, HeaderTenantResolutionStrategy>();
            }
            else
            {
                serviceCollection.AddScoped((serviceProvider) => tenantResolutionStrategy);
            }
        }
 public TenantRepository(ILogger <TenantRepository <T> > logger, ITenantResolutionStrategy tenantResolutionStrategy, ITenantStore <T> tenantStore)
 {
     _logger = logger;
     _tenantResolutionStrategy = tenantResolutionStrategy;
     _tenantStore = tenantStore;
 }
 public TenantAccessService(ITenantResolutionStrategy tenantResolutionStrategy, ITenantStore <T> tenantStore)
 {
     _tenantResolutionStrategy = tenantResolutionStrategy;
     _tenantStore = tenantStore;
 }
Esempio n. 5
0
 /// <summary>
 /// Creates new instances of <see cref="TenantService{TTenant, TKey}"/>
 /// </summary>
 /// <param name="tenantResolutionStrategy"></param>
 /// <param name="tenantStore"></param>
 public TenantService(ITenantResolutionStrategy <TKey> tenantResolutionStrategy, ITenantStore <TTenant, TKey> tenantStore)
 {
     _tenantResolutionStrategy = tenantResolutionStrategy;
     _tenantStore = tenantStore;
 }