refactor(repository): add query parameter to IRepository.Where and constrain IRepository.Entity
- Updated `IRepository<TEntity>.Where()` to accept an `Expression<Func<TEntity, bool>>` for filtering. - Added `where TEntity : IEntity` constraint to `IRepository.Entity<TEntity>()` method. - No functional logic changes, only interface refactoring for stronger typing and query support.
This commit is contained in:
@@ -11,7 +11,7 @@ public interface IRepository<TEntity>
|
||||
|
||||
public Task<IEnumerable<TEntity>> CreateAsync(IEnumerable<TEntity> entities, CancellationToken cancel = default);
|
||||
|
||||
public IQueryable<TEntity> Where();
|
||||
public IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression);
|
||||
|
||||
public IQueryable<TEntity> Get();
|
||||
|
||||
@@ -34,5 +34,5 @@ public interface IRepository<TEntity>
|
||||
|
||||
public interface IRepository
|
||||
{
|
||||
public IRepository<TEntity> Entity<TEntity>();
|
||||
public IRepository<TEntity> Entity<TEntity>() where TEntity : IEntity;
|
||||
}
|
||||
Reference in New Issue
Block a user