Search documentationEsc

IRepository<TItem>

This is the repository interface for any implementation of

Namespace: Microsoft.Azure.CosmosRepository
Kind: interface

This is the repository interface for any implementation of TItem, exposing asynchronous C.R.U.D. functionality. It exposes both IReadOnlyRepository and IWriteOnlyRepository, providing a fully functioning repository.

public interface IRepository<TItem> : IReadOnlyRepository<TItem>, IWriteOnlyRepository<TItem>, IBatchRepository<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 IRepository<SomePoco> _pocoRepository;
public ConsumingService(
IRepository<SomePoco> pocoRepository) =>
_pocoRepository = pocoRepository;
}