Class TenantContext
- Namespace
- Compendium.Multitenancy
- Assembly
- Compendium.Multitenancy.dll
Default implementation of tenant context using AsyncLocal for thread-safe tenant isolation. Maintains tenant information per async context, ensuring proper isolation in concurrent scenarios.
public sealed class TenantContext : ITenantContext
- Inheritance
-
TenantContext
- Implements
- Inherited Members
Properties
CurrentTenant
Gets the complete information of the current tenant.
public TenantInfo? CurrentTenant { get; }
Property Value
HasTenant
Gets a value indicating whether a tenant is currently set.
public bool HasTenant { get; }
Property Value
TenantId
Gets the ID of the current tenant.
public string? TenantId { get; }
Property Value
TenantName
Gets the name of the current tenant.
public string? TenantName { get; }
Property Value
Methods
SetTenant(TenantInfo?)
Sets the current tenant information.
public void SetTenant(TenantInfo? tenant)
Parameters
tenantTenantInfoThe tenant information to set.