예제 #1
0
        public virtual IEnumerable <TEntity> GetAll(params Expression <Func <TEntity, object> >[] navigationProperties)
        {
            IQueryable <TEntity> dbQuery = _context.Set <TEntity>();

            //Apply eager loading
            foreach (Expression <Func <TEntity, object> > navigationProperty in navigationProperties)
            {
                _dbQuery = _dbQuery.Include <TEntity, object>(navigationProperty);
            }

            return(_dbQuery
                   .AsNoTracking()
                   .ToList <TEntity>());
        }
예제 #2
0
 public Repository(CompassContext context)
 {
     _context = context;
     _dbQuery = context.Set <TEntity>();
 }