Interface ITenantRepository
- Namespace
- Stratara.Projections.Multitenancy.Repositories
- Assembly
- Stratara.Projections.dll
Read-store repository for TenantView. Implementations live in the EFCore package and are resolved via IProjectionsUnitOfWork.
public interface ITenantRepository
- Extension Methods
Methods
AddAsync(TenantView, CancellationToken)
Inserts a new tenant view and returns its identifier.
Task<Guid> AddAsync(TenantView tenant, CancellationToken cancellationToken = default)
Parameters
tenantTenantViewThe view to insert.
cancellationTokenCancellationTokenCancellation token.
Returns
DeleteAsync(Guid, CancellationToken)
Deletes the tenant view with the given identifier. Returns true if a row was removed.
Task<bool> DeleteAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe tenant identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
DeleteCustomerTenantsAsync(Guid, CancellationToken)
Deletes every tenant belonging to the given customer. Returns the number of rows removed.
Task<int> DeleteCustomerTenantsAsync(Guid customerId, CancellationToken cancellationToken)
Parameters
customerIdGuidThe customer identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
ExistsAsync(Guid, CancellationToken)
Returns true if a tenant view exists for the given identifier.
Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe tenant identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
GetAllActiveAsync(CancellationToken)
Returns every active tenant in the store.
Task<IReadOnlyList<TenantView>> GetAllActiveAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation token.
Returns
GetAllCustomerTenantsAsync(Guid, CancellationToken)
Returns every tenant — active or not — belonging to the given customer.
Task<IReadOnlyList<TenantView>> GetAllCustomerTenantsAsync(Guid customerId, CancellationToken cancellationToken = default)
Parameters
customerIdGuidThe customer identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
GetAsync(Guid, CancellationToken)
Loads the tenant view by identifier, or null if no row exists.
ValueTask<TenantView?> GetAsync(Guid id, CancellationToken cancellationToken = default)
Parameters
idGuidThe tenant identifier.
cancellationTokenCancellationTokenCancellation token.
Returns
Update(TenantView)
Updates an existing tenant view in the change tracker. Changes are persisted on transaction commit.
TenantView Update(TenantView tenantView)
Parameters
tenantViewTenantViewThe view to update.