Interface IOwnedItemRepository<T>
Defines the contract for a repository that manages items that have an owner.
Inherited Members
Namespace: Benday.CosmosDb.Repositories
Assembly: Benday.CosmosDb.dll
Syntax
public interface IOwnedItemRepository<T> : IRepository<T> where T : class, IOwnedItem, new()
Type Parameters
| Name | Description |
|---|---|
| T | Domain model type managed by the repository |
Methods
| Edit this page View SourceDeleteAllByOwnerIdAsync(string, int, int, CancellationToken)
Deletes all items for the specified owner with configurable throttling and retry logic.
Declaration
Task DeleteAllByOwnerIdAsync(string ownerId, int maxConcurrency, int maxRetries, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownerId | Owner 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 |
DeleteAllByOwnerIdAsync(string, CancellationToken)
Deletes all items for the specified owner with throttling and retry logic.
Declaration
Task DeleteAllByOwnerIdAsync(string ownerId, CancellationToken cancellationToken = default)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownerId | Owner id for the items to delete |
| CancellationToken | cancellationToken | Cancellation token |
Returns
| Type | Description |
|---|---|
| Task |
DeleteAsync(T)
Delete an item from the repository.
Declaration
Task DeleteAsync(T itemToDelete)
Parameters
| Type | Name | Description |
|---|---|---|
| T | itemToDelete | Item to delete |
Returns
| Type | Description |
|---|---|
| Task |
GetAllAsync(string)
Get all items in the repository that have the specified owner id.
Declaration
Task<IEnumerable<T>> GetAllAsync(string ownerId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownerId | Owner id |
Returns
| Type | Description |
|---|---|
| Task<IEnumerable<T>> | Matching items |
GetByIdAsync(string, string)
Get a specific item by its id and owner id.
Declaration
Task<T?> GetByIdAsync(string ownerId, string id)
Parameters
| Type | Name | Description |
|---|---|---|
| string | ownerId | Owner id |
| string | id | Id for the entity |
Returns
| Type | Description |
|---|---|
| Task<T> | The matching item or null |
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 |
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 |