Skip to main content
Table of Contents

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

tenant TenantView

The view to insert.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<Guid>

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

id Guid

The tenant identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

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

customerId Guid

The customer identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<int>

ExistsAsync(Guid, CancellationToken)

Returns true if a tenant view exists for the given identifier.

Task<bool> ExistsAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The tenant identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<bool>

GetAllActiveAsync(CancellationToken)

Returns every active tenant in the store.

Task<IReadOnlyList<TenantView>> GetAllActiveAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<TenantView>>

GetAllCustomerTenantsAsync(Guid, CancellationToken)

Returns every tenant — active or not — belonging to the given customer.

Task<IReadOnlyList<TenantView>> GetAllCustomerTenantsAsync(Guid customerId, CancellationToken cancellationToken = default)

Parameters

customerId Guid

The customer identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<IReadOnlyList<TenantView>>

GetAsync(Guid, CancellationToken)

Loads the tenant view by identifier, or null if no row exists.

ValueTask<TenantView?> GetAsync(Guid id, CancellationToken cancellationToken = default)

Parameters

id Guid

The tenant identifier.

cancellationToken CancellationToken

Cancellation token.

Returns

ValueTask<TenantView>

Update(TenantView)

Updates an existing tenant view in the change tracker. Changes are persisted on transaction commit.

TenantView Update(TenantView tenantView)

Parameters

tenantView TenantView

The view to update.

Returns

TenantView