IBatchRepository<TItem>
This is the batch enabled repository interface for any implementation of
Namespace: Microsoft.Azure.CosmosRepository
Kind: interface
This is the batch enabled repository interface for any implementation of
TItem, exposing asynchronous batch update and create functionality.
public interface IBatchRepository<in TItem> where TItem : IItemType parameters
| Name | Description |
|---|---|
TItem | The IItem implementation class type. |
Example
With DI, use .ctor injection to require any implementation of IItem:
public class ConsumingService{ readonly IBatchRepository<SomePoco> _pocoRepository;
public ConsumingService( IBatchRepository<SomePoco> pocoRepository) => _pocoRepository = pocoRepository;}Members
Methods
IBatchRepository<TItem>.UpdateAsBatchAsync(IEnumerable<TItem>, CancellationToken)
Updates an IEnumerable as a batch.
ValueTask UpdateAsBatchAsync(IEnumerable<in TItem> items, CancellationToken cancellationToken = default)Parameters
| Name | Type | Description |
|---|---|---|
items | IEnumerable{{TItem}} | The items to update. |
cancellationToken | CancellationToken | A token to cancel the async operation. |
Returns — ValueTask: An ValueTask that represents the async batch operation.
IBatchRepository<TItem>.CreateAsBatchAsync(IEnumerable<TItem>, CancellationToken)
Creates an IEnumerable as a batch.
ValueTask CreateAsBatchAsync(IEnumerable<in TItem> items, CancellationToken cancellationToken = default)Parameters
| Name | Type | Description |
|---|---|---|
items | IEnumerable{{TItem}} | The items to create. |
cancellationToken | CancellationToken | A token to cancel the async operation. |
Returns — ValueTask: An ValueTask that represents the async batch operation.
IBatchRepository<TItem>.DeleteAsBatchAsync(IEnumerable<TItem>, CancellationToken)
Deletes an IEnumerable as a batch.
ValueTask DeleteAsBatchAsync(IEnumerable<in TItem> items, CancellationToken cancellationToken = default)Parameters
| Name | Type | Description |
|---|---|---|
items | IEnumerable{{TItem}} | The items to create. |
cancellationToken | CancellationToken | A token to cancel the async operation. |
Returns — ValueTask: An ValueTask that represents the async batch operation.