Table of Contents

Class MultitenancyBuilder

Namespace
BytLabs.Multitenancy
Assembly
BytLabs.Multitenancy.dll

Builder class for configuring multi-tenancy services.

public sealed class MultitenancyBuilder
Inheritance
MultitenancyBuilder
Inherited Members

Constructors

MultitenancyBuilder(IServiceCollection)

Initializes a new instance of the MultitenancyBuilder class.

public MultitenancyBuilder(IServiceCollection services)

Parameters

services IServiceCollection

The service collection to configure.

Properties

Services

Gets the service collection being configured.

public IServiceCollection Services { get; }

Property Value

IServiceCollection

Methods

AddResolver(ITenantIdResolver)

Adds a tenant ID resolver instance to the service collection.

public MultitenancyBuilder AddResolver(ITenantIdResolver resolver)

Parameters

resolver ITenantIdResolver

The resolver instance to add.

Returns

MultitenancyBuilder

The builder instance for method chaining.

AddResolver<T>()

Adds a tenant ID resolver type to the service collection.

public MultitenancyBuilder AddResolver<T>() where T : class, ITenantIdResolver

Returns

MultitenancyBuilder

The builder instance for method chaining.

Type Parameters

T

The type of resolver to add.

AddResolver<T>(Func<IServiceProvider, T>)

Adds a tenant ID resolver using a factory function.

public MultitenancyBuilder AddResolver<T>(Func<IServiceProvider, T> factory) where T : class, ITenantIdResolver

Parameters

factory Func<IServiceProvider, T>

The factory function to create the resolver.

Returns

MultitenancyBuilder

The builder instance for method chaining.

Type Parameters

T

The type of resolver to add.