Docs
Tenantry CoreAPI reference

HeaderTenantResolver class

Namespace: Tenantry.AspNetCore.Resolution · Package: Tenantry.AspNetCore · API reference

Resolves the tenant from a request header (e.g. X-Tenant-Id).

public sealed class HeaderTenantResolver : ITenantResolver

Implements ITenantResolver.

Constructors

HeaderTenantResolver(string)

Resolves the tenant from a request header (e.g. X-Tenant-Id).

public HeaderTenantResolver(string headerName)

Parameters:

  • headerName string: The name of the header that carries the tenant identifier.

Methods

ResolveAsync(HttpContext, CancellationToken)

Attempts to extract a tenant ID from the current request.

public ValueTask<string?> ResolveAsync(HttpContext context, CancellationToken cancellationToken = default)

Parameters:

  • context HttpContext: The current HTTP context.
  • cancellationToken CancellationToken: Cancellation token.

Returns: ValueTask<string>: The resolved tenant ID string, or null if this resolver cannot determine the tenant from the current request.

On this page