Search documentationEsc

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 : IItem

Type parameters

NameDescription
TItemThe 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

NameTypeDescription
itemsIEnumerable{{TItem}}The items to update.
cancellationTokenCancellationTokenA token to cancel the async operation.

ReturnsValueTask: 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

NameTypeDescription
itemsIEnumerable{{TItem}}The items to create.
cancellationTokenCancellationTokenA token to cancel the async operation.

ReturnsValueTask: 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

NameTypeDescription
itemsIEnumerable{{TItem}}The items to create.
cancellationTokenCancellationTokenA token to cancel the async operation.

ReturnsValueTask: An ValueTask that represents the async batch operation.