Skip to content

SingleTenantContext

Namespace AgentPrism · Assembly AgentPrism.Core.dll

The default tenant context for single-tenant deployments. It always returns AgentPrismOptions.DefaultTenantId.

public sealed class SingleTenantContext : ITenantContext

objectSingleTenantContext

ITenantContext

object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

In multi-tenant scenarios, the consumer registers its ITenantContext implementation before calling AddAgentPrism. AgentPrism uses TryAdd, so the consumer registration wins.

SingleTenantContext(IOptions<AgentPrismOptions>)

Section titled “ SingleTenantContext(IOptions<AgentPrismOptions>)”

Initializes a new single-tenant context.

public SingleTenantContext(IOptions<AgentPrismOptions> options)

options IOptions<AgentPrismOptions>

The AgentPrism options.

ArgumentNullException

options is null.

The current tenant’s identifier. Never returns empty.

public string TenantId { get; }

string

When AmbientTenantScope.Current is set, for example while a scheduled job runs, its value takes precedence over the default.