QueryStringTenantResolver class
Namespace: Tenantry.AspNetCore · Package: Tenantry.AspNetCore · API reference
Resolves the tenant from a query string parameter (e.g. ?tenantId=acme).
Intended for local development and testing convenience only. Do not enable in production — query string parameters are logged and may appear in analytics, CDN caches, and browser history.
public sealed class QueryStringTenantResolver : ITenantResolverImplements ITenantResolver.
Constructors
QueryStringTenantResolver(string)
Resolves the tenant from a query string parameter (e.g. ?tenantId=acme).
public QueryStringTenantResolver(string parameterName = "tenantId")Parameters:
parameterNamestring: The name of the query string parameter that carries the tenant identifier.
Intended for local development and testing convenience only. Do not enable in production — query string parameters are logged and may appear in analytics, CDN caches, and browser history.
Methods
ResolveAsync(HttpContext, CancellationToken)
Attempts to read a tenant identifier from the current request.
public ValueTask<string?> ResolveAsync(HttpContext context, CancellationToken cancellationToken = default)Parameters:
contextHttpContext: The current HTTP context.cancellationTokenCancellationToken: Cancellation token.
Returns: ValueTask<string>: The identifier, or null (or an empty string) if this resolver cannot determine the tenant from the current request. Return it as the request carries it: the tenant store finds the tenant it names.
ITenantResolver interface
Reads a tenant identifier from an HTTP request: the tenant's id, or a name the tenant store maps to a tenant, such as a subdomain or a host name see ITenantStore<TKey>.FindByIdentifierAsynctenantry-itenantstore.md.
RequireTenantAttribute class
Requires Tenantry to resolve a tenant before the endpoint or controller action executes.