Table of Contents

Class HostTenantResolver

Namespace
Compendium.Multitenancy
Assembly
Compendium.Multitenancy.dll

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

public sealed class HostTenantResolver : ITenantResolver
Inheritance
HostTenantResolver
Implements
Inherited Members

Constructors

HostTenantResolver(ITenantStore, HostTenantResolverOptions, ILogger<HostTenantResolver>)

Initializes a new instance of the HostTenantResolver class.

public HostTenantResolver(ITenantStore tenantStore, HostTenantResolverOptions options, ILogger<HostTenantResolver> logger)

Parameters

tenantStore ITenantStore

The tenant store for retrieving tenant information.

options HostTenantResolverOptions

The configuration options for host-based resolution.

logger ILogger<HostTenantResolver>

The logger instance.

Exceptions

ArgumentNullException

Thrown when any parameter is null.

Methods

ResolveTenantAsync(TenantResolutionContext, CancellationToken)

Resolves tenant information from the request host/domain.

public Task<Result<TenantInfo?>> ResolveTenantAsync(TenantResolutionContext context, CancellationToken cancellationToken = default)

Parameters

context TenantResolutionContext

The tenant resolution context containing request information.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<Result<TenantInfo>>

A task representing the asynchronous operation with the resolved tenant or null if not found.