Created
February 2, 2024 13:39
-
-
Save glen-84/f9629976e8fac78c514c83a154f46c7b to your computer and use it in GitHub Desktop.
Generic repository interface
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IRepository<TAggregateRoot> where TAggregateRoot : IAggregateRoot | |
{ | |
public void Add(params TAggregateRoot[] entities); | |
public void Remove(params TAggregateRoot[] entities); | |
public Task<TAggregateRoot?> SingleOrDefaultAsync( | |
ISpecification<TAggregateRoot> specification, | |
CancellationToken cancellationToken = default); | |
public Task<TResult?> SingleOrDefaultAsync<TResult>( | |
ISpecification<TAggregateRoot, TResult> specification, | |
CancellationToken cancellationToken = default); | |
public Task<TAggregateRoot?> SingleOrDefaultByIdAsync<TId>( | |
TId entityId, | |
CancellationToken cancellationToken = default) | |
where TId : IId; | |
public Task<IList<TAggregateRoot>> ListAsync( | |
ISpecification<TAggregateRoot> specification, | |
CancellationToken cancellationToken = default); | |
public Task<IList<TResult>> ListAsync<TResult>( | |
ISpecification<TAggregateRoot, TResult> specification, | |
CancellationToken cancellationToken = default); | |
public Task<bool> IsUniqueAsync(ISpecification<TAggregateRoot> specification, IId? existingId); | |
public Task<int> DeleteAsync( | |
ISpecification<TAggregateRoot> specification, | |
CancellationToken cancellationToken = default); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment