Exemple #1
0
        private void ParseWhereExpresson(Expression node)
        {
            var visitor = new WhereExpressionVisitor(context);

            visitor.Visit(node);
            if (this.context.Fragment.WherePart == null)
            {
                this.context.Fragment.WherePart = visitor.Condition;
            }
            else
            {
                this.context.Fragment.WherePart = this.context.Fragment.WherePart.Concat(visitor.Condition);
            }
        }
Exemple #2
0
        protected override Expression VisitLambda <T>(Expression <T> node)
        {
            var elementType = typeof(T);

            if (elementType.IsGenericType && elementType.GetGenericArguments().Last() == typeof(bool))
            {
                var visitor = new WhereExpressionVisitor(context);
                visitor.Visit(node);
                context.Fragment.WherePart = visitor.Condition;
            }
            else
            {
                Visit(node.Body);
            }
            return(node);
        }
        private Condition GetRelationCondition(string relation, BinaryExpression node)
        {
            var condition = new GroupCondition();

            condition.Relation = relation;

            var leftVisitor = new WhereExpressionVisitor(this.Context);

            leftVisitor.Visit(node.Left);
            condition.Left = leftVisitor.Condition;

            var rightVisitor = new WhereExpressionVisitor(this.Context);

            rightVisitor.Visit(node.Right);
            condition.Right = rightVisitor.Condition;

            return(condition);
        }