.NET API
MutableTenantContext
Tracon.Testing.Contracts.Xunit.dllAn ITenantContext whose tenant can be swapped at run time.
public sealed class MutableTenantContext : ITenantContext- Inheritance
- object ← MutableTenantContext
- 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”Some stores take the tenant as a method parameter, others read it from
ITenantContext (for example IRunStore,
ISessionStore, IAgentDefinitionStore). To write a two-tenant
scenario for the second group, we need either two separate store
instances or a single context whose tenant can be swapped. The latter was
chosen: the same store instance points at the same backend, and the
question “does B see what A wrote” can be asked against a single store.
Constructors
Section titled “Constructors”MutableTenantContext(string)
Section titled “ MutableTenantContext(string)”An ITenantContext whose tenant can be swapped at run time.
public MutableTenantContext(string tenantId)Parameters
Section titled “Parameters”tenantId string
The initial tenant.
Remarks
Section titled “Remarks”Some stores take the tenant as a method parameter, others read it from
ITenantContext (for example IRunStore,
ISessionStore, IAgentDefinitionStore). To write a two-tenant
scenario for the second group, we need either two separate store
instances or a single context whose tenant can be swapped. The latter was
chosen: the same store instance points at the same backend, and the
question “does B see what A wrote” can be asked against a single store.
Properties
Section titled “Properties”TenantId
Section titled “ TenantId”The current tenant’s identifier. Never returns empty.
public string TenantId { get; set; }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.