refactor(Repository): add Query getter metod to Repository calss and interface to be able to create read-only query without expression
This commit is contained in:
parent
1e35692a02
commit
00e5f6c0e9
@ -40,6 +40,11 @@ public interface IRepository<TEntity>
|
|||||||
#endregion Create
|
#endregion Create
|
||||||
|
|
||||||
#region Read
|
#region Read
|
||||||
|
#if NET
|
||||||
|
public
|
||||||
|
#endif
|
||||||
|
IQueryable<TEntity> Query { get; }
|
||||||
|
|
||||||
#if NET
|
#if NET
|
||||||
public
|
public
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -73,6 +73,8 @@ public class DbRepository<TDbContext, TEntity> : IRepository<TEntity> where TDbC
|
|||||||
#endregion Create
|
#endregion Create
|
||||||
|
|
||||||
#region Read
|
#region Read
|
||||||
|
public virtual IQueryable<TEntity> Query => Entities.AsNoTracking();
|
||||||
|
|
||||||
public virtual IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression) => Entities.AsNoTracking().Where(expression);
|
public virtual IQueryable<TEntity> Where(Expression<Func<TEntity, bool>> expression) => Entities.AsNoTracking().Where(expression);
|
||||||
|
|
||||||
public virtual IEnumerable<TEntity> GetAll() => Entities.AsNoTracking().ToList();
|
public virtual IEnumerable<TEntity> GetAll() => Entities.AsNoTracking().ToList();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user