Table of Contents

Class TenantScope

Namespace
Compendium.Multitenancy
Assembly
Compendium.Multitenancy.dll

Provides a disposable scope for temporarily setting a tenant context. When disposed, restores the previous tenant context, enabling nested tenant contexts.

public sealed class TenantScope : IDisposable
Inheritance
TenantScope
Implements
Inherited Members

Constructors

TenantScope(TenantContext, TenantInfo?)

Initializes a new instance of the TenantScope class.

public TenantScope(TenantContext context, TenantInfo? tenant)

Parameters

context TenantContext

The tenant context to modify.

tenant TenantInfo

The tenant information to set for this scope.

Exceptions

ArgumentNullException

Thrown when context is null.

Methods

Dispose()

Restores the previous tenant context when the scope is disposed.

public void Dispose()