Esempio n. 1
0
        public IList <T> GetAll(Expression <Func <T, bool> > predicate = null, params Expression <Func <T, object> >[] includeProperties)
        {
            IQueryable <T> query = _dbContext.Set <T>();

            if (predicate != null)
            {
                query = query.Where(predicate);
            }
            if (includeProperties.Any())
            {
                foreach (var item in includeProperties)
                {
                    query = query.Include(item);
                }
            }

            return(query.ToList());
        }
Esempio n. 2
0
 public EfRepository(WorkFollowDataContext dbContext)
 {
     _dbContext = dbContext;
     this.dbSet = _dbContext.Set <T>();
 }