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
tenantStoreITenantStoreThe tenant store for retrieving tenant information.
optionsHostTenantResolverOptionsThe configuration options for host-based resolution.
loggerILogger<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
contextTenantResolutionContextThe tenant resolution context containing request information.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<Result<TenantInfo>>
A task representing the asynchronous operation with the resolved tenant or null if not found.