Table of Contents

Namespace Compendium.Multitenancy

Classes

CompositeTenantResolver

A composite tenant resolver that tries multiple resolution strategies in sequence. Returns the result from the first resolver that successfully identifies a tenant.

DatabaseIsolationOptions

Configuration options for database-level tenant isolation strategy.

DatabaseIsolationStrategy

Implements tenant isolation by providing each tenant with a separate database. This strategy offers the highest level of isolation but requires more database resources.

HeaderTenantResolver

A tenant resolver that identifies tenants based on HTTP headers. Looks for tenant identifier in a specified header and resolves the tenant from storage.

HeaderTenantResolverOptions

Configuration options for header-based tenant resolution.

HostTenantResolver

A tenant resolver that identifies tenants based on the request host/domain. Can resolve tenants from subdomains or full domain names.

HostTenantResolverOptions

Configuration options for host-based tenant resolution.

JwtClaimTenantResolver

A tenant resolver that identifies tenants based on JWT claims. Extracts tenant identifier from a specified claim in the authenticated user's token.

JwtClaimTenantResolverOptions

Configuration options for JWT claim-based tenant resolution.

SchemaIsolationOptions

Configuration options for schema-level tenant isolation strategy.

SchemaIsolationStrategy

Implements tenant isolation by providing each tenant with a separate schema within a shared database. This strategy balances isolation with resource efficiency.

TenantConsistencyOptions

Configuration options for tenant consistency validation.

TenantConsistencyValidator

Default implementation of ITenantConsistencyValidator.

TenantContext

Default implementation of tenant context using AsyncLocal for thread-safe tenant isolation. Maintains tenant information per async context, ensuring proper isolation in concurrent scenarios.

TenantContextAccessor

Default implementation of the tenant context accessor. Uses AsyncLocal to maintain tenant context per async context.

TenantErrors

Standard tenant-related errors.

TenantInfo

Represents information about a tenant in a multi-tenant application. Contains all necessary data to identify and configure tenant-specific behavior.

TenantResolutionContext

Contains context information used for tenant resolution. Aggregates various request properties that tenant resolvers can use to identify tenants.

TenantScope

Provides a disposable scope for temporarily setting a tenant context. When disposed, restores the previous tenant context, enabling nested tenant contexts.

TenantSourceIdentifiers

Contains tenant identifiers from various sources for consistency validation.

Interfaces

ITenantConsistencyValidator

Validates that tenant identifiers from multiple sources are consistent. Ensures header, subdomain, and JWT claim all reference the same tenant.

ITenantContext

Provides access to the current tenant context information. Enables applications to operate in a multi-tenant environment by tracking the active tenant.

ITenantContextAccessor

Provides access to the current tenant context in a thread-safe manner. This is the primary interface for reading tenant information from any layer.

ITenantContextSetter

Provides access to the tenant context and allows modification. This interface is used by middleware and tenant resolution components.

ITenantIsolationStrategy

Defines a strategy for isolating tenant data in a multi-tenant application. Implementations determine how tenants are separated at the database level.

ITenantResolver

Defines a strategy for resolving tenant information from request context. Implementations can resolve tenants from various sources like headers, domains, or paths.

ITenantStore

Defines the contract for storing and retrieving tenant information. Provides persistent storage capabilities for multi-tenant applications.

Enums

IsolationLevel

Defines the levels of data isolation supported in multi-tenant applications.