SingleTenantContext
Namespace AgentPrism · Assembly
AgentPrism.Core.dllThe default tenant context for single-tenant deployments. It always returns AgentPrismOptions.DefaultTenantId.
public sealed class SingleTenantContext : ITenantContextInheritance
Section titled “Inheritance”Implements
Section titled “Implements”Inherited Members
Section titled “Inherited Members”object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()
Remarks
Section titled “Remarks”In multi-tenant scenarios, the consumer registers its ITenantContext
implementation before calling AddAgentPrism. AgentPrism uses
TryAdd, so the consumer registration wins.
Constructors
Section titled “Constructors”SingleTenantContext(IOptions<AgentPrismOptions>)
Section titled “ SingleTenantContext(IOptions<AgentPrismOptions>)”Initializes a new single-tenant context.
public SingleTenantContext(IOptions<AgentPrismOptions> options)Parameters
Section titled “Parameters”options IOptions<AgentPrismOptions>
The AgentPrism options.
Exceptions
Section titled “Exceptions”options is null.
Properties
Section titled “Properties”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”When AmbientTenantScope.Current is set, for example while a scheduled job runs, its value takes precedence over the default.