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:
2025-08-25 14:56:19 +02:00
parent 003636e243
commit 75d0a6f1df
2 changed files with 8 additions and 8 deletions

View File

@@ -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);
}