Interface ITenantStore
- Namespace
- Compendium.Multitenancy
- Assembly
- Compendium.Multitenancy.dll
Defines the contract for storing and retrieving tenant information. Provides persistent storage capabilities for multi-tenant applications.
public interface ITenantStore
Methods
DeleteAsync(string, CancellationToken)
Deletes a tenant from the store.
Task<Result> DeleteAsync(string tenantId, CancellationToken cancellationToken = default)
Parameters
tenantIdstringThe unique identifier of the tenant to delete.
cancellationTokenCancellationTokenThe cancellation token.
Returns
GetAllAsync(CancellationToken)
Retrieves all tenants from the store.
Task<Result<IEnumerable<TenantInfo>>> GetAllAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<Result<IEnumerable<TenantInfo>>>
A task representing the asynchronous operation with all tenants.
GetByIdAsync(string, CancellationToken)
Retrieves a tenant by its unique identifier.
Task<Result<TenantInfo?>> GetByIdAsync(string tenantId, CancellationToken cancellationToken = default)
Parameters
tenantIdstringThe unique identifier of the tenant.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<Result<TenantInfo>>
A task representing the asynchronous operation with the tenant or null if not found.
GetByIdentifierAsync(string, CancellationToken)
Retrieves a tenant by an alternate identifier (e.g., subdomain, custom key).
Task<Result<TenantInfo?>> GetByIdentifierAsync(string identifier, CancellationToken cancellationToken = default)
Parameters
identifierstringThe alternate identifier to search for.
cancellationTokenCancellationTokenThe cancellation token.
Returns
- Task<Result<TenantInfo>>
A task representing the asynchronous operation with the tenant or null if not found.
SaveAsync(TenantInfo, CancellationToken)
Saves a tenant to the store (create or update).
Task<Result> SaveAsync(TenantInfo tenant, CancellationToken cancellationToken = default)
Parameters
tenantTenantInfoThe tenant information to save.
cancellationTokenCancellationTokenThe cancellation token.