Beispiel #1
0
        public static IQueryable <T> Parse <T>(WhereCondition condition, IQueryable <T> source, string paramName = null)
        {
            Expression <Func <T, bool> > predicate = new LinqWhereExpressionBuilder().BuildPredicate <T>(condition, paramName);

            if (predicate != null)
            {
                source = source.Where(predicate);
            }
            else
            {
                source = source.AsQueryable <T>();
            }
            return(source);
        }
 public IQueryable <T> Parse <T>(IFilter filter, IQueryable <T> source) where T : class, new()
 {
     //parse where clause
     source = LinqWhereExpressionBuilder.Parse <T>(filter.Where, source, filter.As);
     //parse the include clause
     source = LinqIncludeParser.Parse <T>(filter.With, source, filter.As);
     //parse the order clause
     source = LinqOrderParser.ParseOrder <T>(filter.OrderBy, source);
     //parse the pagination
     source = LinqLimitParser.ParseLimit <T>(filter.Skip, filter.Take, source);
     //parse the select clause
     source = LinqSelectParser.ParseSelect <T>(filter.Properties, source, filter.As);
     //return the result
     return(source);
 }