Skip to content
Tracon

FixedTenantContext

Namespace Tracon · Assembly Tracon.Core.dll

An 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()

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.

An immutable tenant context that always returns the same tenant.

public FixedTenantContext(string tenantId)

tenantId string

The tenant identifier to return.

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.

The shared instance that carries the default value of TraconOptions.DefaultTenantId.

public static FixedTenantContext Default { get; }

FixedTenantContext

The current tenant’s identifier. Never returns empty.

public string TenantId { get; }

string

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.