HttpContextExtensions

Extensions for HttpContext class.

Namespace:
Inetdev.AspNetCore.Multitenancy
Type:
Class
Public:
Yes
Protected:
No
Sealed:
Yes
Abstract:
Yes
Inherits from:
System.Object

Methods

GetCurrentTenant

Gets the current ITenant stored within the HttpContext or null if no tenant is found.

Signature:
public GetCurrentTenant<TTenant>(context)
Returns

The ITenant stored within context or null.

Parameters
Name Type Summary
context HttpContext The HttpContext.
Exceptions
Type Summary
ArgumentNullException Thrown when context is null.

SetCurrentTenant

Stores the current ITenant in the HttpContext. If tenant is null a stored tenant is removed from the context.

Signature:
public Void SetCurrentTenant<TTenant>(context, tenant)
Parameters
Name Type Summary
context HttpContext The HttpContext.
tenant TTenant An ITenant to be stored or null to remove an existing one.