feat(repository): refactor UpdateAsync and DeleteAsync to accept query functions
Changed UpdateAsync and DeleteAsync to accept Func<IQueryable<TEntity>, IQueryable<TEntity>> instead of IQueryable<TEntity> Improved flexibility by allowing callers to compose queries dynamically Updated overloads to wrap expressions with q => q.Where(expression) for compatibility
This commit is contained in:
@@ -16,9 +16,9 @@ public interface IRepository<TEntity>
|
||||
|
||||
public Task UpdateAsync<TDto>(TDto dto, Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
|
||||
public Task UpdateAsync<TDto>(TDto dto, IQueryable<TEntity> query, CancellationToken cancel = default);
|
||||
public Task UpdateAsync<TDto>(TDto dto, Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
|
||||
public Task DeleteAsync(Expression<Func<TEntity, bool>> expression, CancellationToken cancel = default);
|
||||
|
||||
public Task DeleteAsync(IQueryable<TEntity> query, CancellationToken cancel = default);
|
||||
public Task DeleteAsync(Func<IQueryable<TEntity>, IQueryable<TEntity>> query, CancellationToken cancel = default);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user