Closed dermeister0 closed 7 years ago
It's not possible to use IAsyncRepository without IRepository, because it does not have Add method (only AddAsync).
Methods AddAsync, AddRangeAsync, RemoveAsync and RemoveRangeAsync are useless. Proposed interface:
public interface IAsyncRepository
{
void Add(TEntity entity);
void AddRange(IEnumerable<TEntity> entities);
Task<IEnumerable<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate, CancellationToken cancellationToken = default(CancellationToken));
Task<IEnumerable<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate, IEnumerable<Expression<Func<TEntity, object>>> includes, CancellationToken cancellationToken = default(CancellationToken));
Task<IEnumerable<TEntity>> GetAllAsync(CancellationToken cancellationToken = default(CancellationToken));
Task<IEnumerable<TEntity>> GetAllAsync(IEnumerable<Expression<Func<TEntity, object>>> includes, CancellationToken cancellationToken = default(CancellationToken));
Task<TEntity> GetAsync(params object[] keyValues, CancellationToken cancellationToken = default(CancellationToken));
void Remove(TEntity entity);
void RemoveRange(IEnumerable<TEntity> entities);
}
Please take a look at new version.
It should have GetAsync, GetAllAsync, FindAsync, Add, AddRange, Remove, RemoveRange methods.
For example: