Class MultiTenantMiddleware<TTenant>
This class implements the multi-tenant middleware processor for retrieving and storing the tenant information into the current request context.
Inheritance
System.Object
MultiTenantMiddleware<TTenant>
Namespace: Talegen.AspNetCore.Multitenant
Assembly: Talegen.AspNetCore.Multitenant.dll
Syntax
public class MultiTenantMiddleware<TTenant> : object where TTenant : class, ITenant, new()
Type Parameters
Name | Description |
---|---|
TTenant | The type of the tenant. |
Constructors
| Improve this Doc View SourceMultiTenantMiddleware(RequestDelegate)
Initializes a new instance of the MultiTenantMiddleware<TTenant> class.
Declaration
public MultiTenantMiddleware(RequestDelegate next)
Parameters
Type | Name | Description |
---|---|---|
RequestDelegate | next | The next request delegate. |
MultiTenantMiddleware(RequestDelegate, ILogger)
Initializes a new instance of the MultiTenantMiddleware<TTenant> class.
Declaration
public MultiTenantMiddleware(RequestDelegate next, ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
RequestDelegate | next | The next request delegate. |
ILogger | logger | Contains a logger instance. |
Methods
| Improve this Doc View SourceInvoke(HttpContext)
Invokes the specified context request to retrieve and apply the tenant context.
Declaration
public async Task Invoke(HttpContext context)
Parameters
Type | Name | Description |
---|---|---|
HttpContext | context | The HTTP context. |
Returns
Type | Description |
---|---|
Task |
Remarks
For every request, the HttpContext is modified here to get the tenant context. The Tenant context property is then updated with tenant lookup results.