示例#1
0
        private Expression CreateFilterExpression(out EvoQLExpression parse, out ParameterExpression parameter, Type elementType)
        {
            parse = ParseQuery();

            var root = parse.Tree;

            if (root is GetExpression)
            {
                var get = (GetExpression)root;

                get.ElementType = elementType;

                var expression = get.CreateExpression(null);

                parameter = Expression.Parameter(elementType, "x");

                if (expression == null)
                {
                    return(null);
                }
                return(ParameterRebinder.ReplaceParameters(expression, "x", parameter));
            }

            parameter = null;
            return(null);
        }
示例#2
0
        public Expression GetPagingExpression(Type itemType)
        {
            EvoQLExpression parse = ParseQuery();

            if (parse.Tree is GetExpression)
            {
                GetExpression get = (GetExpression)parse.Tree;

                var res = ReduceExpressionGeneration.GetPagingExpression(get, itemType);

                return(res);
                //return new ExpressionResult { Expression = res, Collections = GetCollections(parse) };
            }

            return(null);
        }
示例#3
0
        private EvoQLExpression ParseQuery()
        {
            var parse = new EvoQLExpression(_query);

            if (parse.HadErrors)
            {
                string errorString = "EvoQL Error For: ";
                errorString += _query;
                errorString += "\n";
                foreach (string error in parse.Errors)
                {
                    errorString += error + "\n";
                }
                throw new EvoQLException(errorString);
            }

            parse.Tree.Init();
            return(parse);
        }