public virtual List <TEntity> GetAllGroup(Expression <Func <TEntity, bool> > filter = null, Func <IQueryable <TEntity>, IOrderedQueryable <TEntity> > orderyby = null, string includingProperties = null, bool noTracking = true, string[] groupBy = null ) { IQueryable <TEntity> query = dbset; if (includingProperties != null) { foreach (var includeproperty in includingProperties.Split (new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries)) { query = query.Include(includeproperty); } } if (filter != null) { query = query.Where(filter); // query = query.Where(tt => !(bool)tt.GetType().GetProperty("IsDeleted").GetValue(tt, null)); } if (groupBy != null) { var lambda = ExpressionEx.GroupByExpression <TEntity>(groupBy); return(query.AsEnumerable().GroupBy(lambda.Compile()).SelectMany(cc => cc.ToList()).ToList()); } //return lquery; if (orderyby != null) { if (noTracking) { return(orderyby(query).AsNoTracking().ToList()); } return(orderyby(query).ToList()); } if (noTracking) { return(query.AsNoTracking().ToList()); } return(query.ToList()); }