Tenantry CoreAPI reference
RouteValueTenantResolver class
Namespace: Tenantry.AspNetCore · Package: Tenantry.AspNetCore · API reference
Resolves the tenant from a route value (e.g. /api/{tenant}/resource).
public sealed class RouteValueTenantResolver : ITenantResolverImplements ITenantResolver.
Constructors
RouteValueTenantResolver(string)
Resolves the tenant from a route value (e.g. /api/{tenant}/resource).
public RouteValueTenantResolver(string routeValueKey = "tenant")Parameters:
routeValueKeystring: The name of the route value that carries the tenant identifier.
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.