Skip to content

v5.7.0

Latest
Compare
Choose a tag to compare
@z4kn4fein z4kn4fein released this 20 Dec 15:39

Added

  • IServiceCollection based configuration for tenants
    builder.Host.UseStashboxMultitenant<HttpHeaderTenantIdExtractor>(
      options =>
      {
          // Root container configuration through the IStashboxContainer interface.
          options.RootContainer.Configure(opts => { /* configure the root container */ });
          
          // Configure root services through the IServiceCollection interface.
          options.ConfigureRootServices(services => 
              services.AddTransient<IDependency, DefaultDependency>());
      
          // Configure tenants.
          options.ConfigureTenant("TenantA", tenantContainer => 
              tenantContainer.Configure(opts => { /* configure the tenant container */ }))
              // Register tenant specific service overrides through the IServiceCollection interface.
              .ConfigureServices(services => 
                  services.AddTransient<IDependency, TenantASpecificDependency>());
      
          options.ConfigureTenant("TenantB", tenantContainer => 
              tenantContainer.Configure(opts => { /* configure the tenant container */ }))
              // Register tenant specific service overrides through the IServiceCollection interface.
              .ConfigureServices(services => 
                  services.AddTransient<IDependency, TenantBSpecificDependency>());
      });