.NET API
FixedTenantContext
Tracon.Core.dllAn immutable tenant context that always returns the same tenant.
public sealed class FixedTenantContext : ITenantContext- Inheritance
- object ← FixedTenantContext
- Implements
- ITenantContext
- Inherited Members
- object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”In-memory stores read the tenant through ITenantContext.
When a store is created outside DI directly with new, this type supplies the
context if one is not provided, and the store behaves as single tenant.
Making a store tenant context optional does not make filtering optional. A context always exists. Its value is simply fixed when it is not supplied. Filtering occurs in every code path.
Constructors
Section titled “Constructors”FixedTenantContext(string)
Section titled “ FixedTenantContext(string)”An immutable tenant context that always returns the same tenant.
public FixedTenantContext(string tenantId)Parameters
Section titled “Parameters”tenantId string
The tenant identifier to return.
Remarks
Section titled “Remarks”In-memory stores read the tenant through ITenantContext.
When a store is created outside DI directly with new, this type supplies the
context if one is not provided, and the store behaves as single tenant.
Making a store tenant context optional does not make filtering optional. A context always exists. Its value is simply fixed when it is not supplied. Filtering occurs in every code path.
Properties
Section titled “Properties”Default
Section titled “ Default”The shared instance that carries the default value of TraconOptions.DefaultTenantId.
public static FixedTenantContext Default { get; }Property Value
Section titled “Property Value”TenantId
Section titled “ TenantId”The current tenant’s identifier. Never returns empty.
public string TenantId { get; }Property Value
Section titled “Property Value”Remarks
Section titled “Remarks”The value must be canonical — the form
AmbientTenantScope.Normalize returns. The tenant
identifier is matched case-insensitively across the product, and every
layer achieves that by normalizing the value rather than by comparing
case-insensitively. An implementation that returns Acme where
another path resolves acme splits one tenant into two on
PostgreSQL and SQLite, and merges them on SQL Server’s default
collation — the authorization layer and the storage layer then disagree.