Show / Hide Table of Contents

Interface ITenantItemRepository<T>

Defines the contract for a repository that manages items that belong to a tenant.

Inherited Members
IRepository<T>.SaveAsync(IList<T>)
IRepository<T>.DeleteAsync(string)
IRepository<T>.GetByIdAsync(string)
IRepository<T>.GetAllAsync()
IRepository<T>.GetPagedAsync(int, string)
IAsyncTenantRepository<T, string>.GetByIdAsync(string, string)
IAsyncTenantRepository<T, string>.GetByTenantAsync(string)
IAsyncRepository<T, string>.SaveAsync(T)
IAsyncRepository<T, string>.DeleteAsync(T)
Namespace: Benday.CosmosDb.Repositories
Assembly: Benday.CosmosDb.dll
Syntax
public interface ITenantItemRepository<T> : IRepository<T>, IAsyncTenantRepository<T, string>, IAsyncRepository<T, string> where T : class, ITenantItem, new()
Type Parameters
Name Description
T

Domain model type managed by the repository

Methods

| Edit this page View Source

DeleteAllByTenantIdAsync(string, int, int, CancellationToken)

Deletes all items for the specified tenant with configurable throttling and retry logic.

Declaration
Task DeleteAllByTenantIdAsync(string tenantId, int maxConcurrency, int maxRetries, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string tenantId

Tenant id for the items to delete

int maxConcurrency

Maximum number of concurrent delete operations

int maxRetries

Maximum number of retry attempts for throttled requests

CancellationToken cancellationToken

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

DeleteAllByTenantIdAsync(string, CancellationToken)

Deletes all items for the specified tenant with throttling and retry logic.

Declaration
Task DeleteAllByTenantIdAsync(string tenantId, CancellationToken cancellationToken = default)
Parameters
Type Name Description
string tenantId

Tenant id for the items to delete

CancellationToken cancellationToken

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

DeleteAsync(T)

Delete an item from the repository. Hides the shared IAsyncRepository DeleteAsync to provide a single unambiguous member.

Declaration
Task DeleteAsync(T itemToDelete)
Parameters
Type Name Description
T itemToDelete

Item to delete

Returns
Type Description
Task
| Edit this page View Source

GetAllAsync(string)

Get all items in the repository that have the specified tenant id.

Declaration
Task<IEnumerable<T>> GetAllAsync(string tenantId)
Parameters
Type Name Description
string tenantId

Tenant id

Returns
Type Description
Task<IEnumerable<T>>

Matching items

| Edit this page View Source

GetByIdAsync(string, string)

Get a specific item by its id and tenant id.

Declaration
Task<T?> GetByIdAsync(string tenantId, string id)
Parameters
Type Name Description
string tenantId

Tenant id

string id

Id for the entity

Returns
Type Description
Task<T>

The matching item or null

| Edit this page View Source

GetPagedAsync(string, int, string?)

Gets a page of results for the specified tenant with continuation support.

Declaration
Task<PagedResults<T>> GetPagedAsync(string tenantId, int pageSize = 100, string? continuationToken = null)
Parameters
Type Name Description
string tenantId

Tenant id

int pageSize

Maximum number of items to return

string continuationToken

Continuation token from previous query (null for first page)

Returns
Type Description
Task<PagedResults<T>>

A page of results with continuation information

| Edit this page View Source

SaveAllAsync(IEnumerable<T>, int, int, CancellationToken)

Saves multiple items with configurable throttling and retry logic.

Declaration
Task SaveAllAsync(IEnumerable<T> items, int maxConcurrency, int maxRetries, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IEnumerable<T> items

Items to save

int maxConcurrency

Maximum number of concurrent save operations

int maxRetries

Maximum number of retry attempts for throttled requests

CancellationToken cancellationToken

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

SaveAllAsync(IEnumerable<T>, CancellationToken)

Saves multiple items with throttling and retry logic.

Declaration
Task SaveAllAsync(IEnumerable<T> items, CancellationToken cancellationToken = default)
Parameters
Type Name Description
IEnumerable<T> items

Items to save

CancellationToken cancellationToken

Cancellation token

Returns
Type Description
Task
| Edit this page View Source

SaveAsync(T)

Save the entity to the repository. Hides the shared IAsyncRepository SaveAsync to resolve ambiguity with IRepository<T>.SaveAsync which returns Task<T>.

Declaration
Task<T> SaveAsync(T entity)
Parameters
Type Name Description
T entity

Entity to save

Returns
Type Description
Task<T>

The saved entity

  • Edit this page
  • View Source
In this article
Back to top Copyright © www.benday.com | info@benday.com