Exemplo n.º 1
0
        public static Expression GetPyszmExp(MemberExpression argument, IEdmFunctions funcs)
        {
            if (funcs == null)
            {
                throw new NotSupportedException("DQuery functions not specified.");
            }

            var pyszm = funcs.GetPyszmFunc();

            if (pyszm == null)
            {
                throw new NotImplementedException("Pyszm function not implemented.");
            }

            return(Expression.Call(null, pyszm.Method, argument));
        }
Exemplo n.º 2
0
        public static IQueryable <TSource> Where <TSource>(this IQueryable <TSource> source, string json, IEdmFunctions funcs)
            where TSource : class
        {
            var clauses = QueryClauseParser.Parse(json);
            var lambda  = ExpressionBuilder.Build <TSource>(clauses.ToList(), funcs);

            return(source.Where(lambda));
        }
Exemplo n.º 3
0
        public static Expression <Func <TSource, bool> > Build <TSource>(List <QueryClause> clauses, IEdmFunctions funcs)
        {
            var parameter = Expression.Parameter(typeof(TSource), "x");
            var builder   = new ExpressionBuilder {
                EdmFunctions = funcs
            };
            var expression = builder.BuildClauseExp <TSource>(clauses, parameter);

            if (expression == null)
            {
                expression = Expression.Constant(true);
            }
            return(Expression.Lambda <Func <TSource, bool> >(expression, parameter));
        }
Exemplo n.º 4
0
 public static IQueryable <TSource> Where <TSource>(this ObjectSet <TSource> source, string json, IEdmFunctions funcs)
     where TSource : class
 {
     return((source as IQueryable <TSource>).Where(json, funcs));
 }