Table of Contents

Interface ITenantIsolationStrategy

Namespace
Compendium.Multitenancy
Assembly
Compendium.Multitenancy.dll

Defines a strategy for isolating tenant data in a multi-tenant application. Implementations determine how tenants are separated at the database level.

public interface ITenantIsolationStrategy

Methods

EnsureTenantResourcesAsync(TenantInfo, CancellationToken)

Ensures that the necessary database resources exist for a tenant.

Task<Result> EnsureTenantResourcesAsync(TenantInfo tenant, CancellationToken cancellationToken = default)

Parameters

tenant TenantInfo

The tenant information.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<Result>

A task representing the asynchronous operation.

GetConnectionStringAsync(TenantInfo, CancellationToken)

Gets the database connection string for a specific tenant.

Task<Result<string>> GetConnectionStringAsync(TenantInfo tenant, CancellationToken cancellationToken = default)

Parameters

tenant TenantInfo

The tenant information.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<Result<string>>

A task representing the asynchronous operation with the connection string.

GetSchemaNameAsync(TenantInfo, CancellationToken)

Gets the schema name for a specific tenant.

Task<Result<string>> GetSchemaNameAsync(TenantInfo tenant, CancellationToken cancellationToken = default)

Parameters

tenant TenantInfo

The tenant information.

cancellationToken CancellationToken

The cancellation token.

Returns

Task<Result<string>>

A task representing the asynchronous operation with the schema name.