Enhance IRepository with async methods and deprecations
Updated the `IRepository<TEntity>` interface in `IRepository.cs` to include new asynchronous methods for reading, updating, and deleting entities. Added `Read`, `UpdateAsync`, and `DeleteAsync` methods while marking several existing methods as obsolete to encourage the use of the new `Read` method returning `IReadQuery<TEntity>`. Removed previous implementations of `UpdateAsync` and `DeleteAsync` for a more streamlined API.
This commit is contained in:
parent
4afeddb7f9
commit
21c895c22b
@ -10,15 +10,21 @@ public interface IRepository<TEntity>
|
||||
|
||||
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken ct = default);
|
||||
|
||||
public Task<IEnumerable<TEntity>> ReadAllAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
||||
|
||||
public Task<TEntity?> ReadOrDefaultAsync(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken ct = default);
|
||||
|
||||
public Task<IEnumerable<TDto>> ReadAllAsync<TDto>(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
||||
|
||||
public Task<TDto?> ReadOrDefaultAsync<TDto>(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken ct = default);
|
||||
public IReadQuery<TEntity> Read(Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
||||
|
||||
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
||||
|
||||
public Task DeleteAsync(Expression<Func<TEntity, bool>> expression, CancellationToken ct = default);
|
||||
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
public Task<IEnumerable<TEntity>> ReadAllAsync(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
||||
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
public Task<TEntity?> ReadOrDefaultAsync(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken ct = default);
|
||||
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
public Task<IEnumerable<TDto>> ReadAllAsync<TDto>(Expression<Func<TEntity, bool>>? expression = null, CancellationToken ct = default);
|
||||
|
||||
[Obsolete("Use Read-method returning IReadQuery<TEntity> instead.")]
|
||||
public Task<TDto?> ReadOrDefaultAsync<TDto>(Expression<Func<TEntity, bool>> expression, bool single = true, CancellationToken ct = default);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user