Esempio n. 1
0
        private void VisitBinaryConstantExpression(BinaryExpression expression)
        {
            ConstantExpression constant = expression.TryGetExpressionOfType <ConstantExpression>();

            if (expression.HasExpressionOfType <MemberExpression>())
            {
                MemberExpression member = expression.TryGetExpressionOfType <MemberExpression>();

                VisitBinaryMemberExpression(expression.NodeType, member, constant);
            }
            else if (expression.HasExpressionOfType <SubQueryExpression>())
            {
                SubQueryExpression subQuery = expression.TryGetExpressionOfType <SubQueryExpression>();

                VisitBinarySubQueryExpression(expression.NodeType, subQuery, constant);
            }
            else if (expression.HasExpressionOfType <QuerySourceReferenceExpression>())
            {
                QuerySourceReferenceExpression querySource = expression.TryGetExpressionOfType <QuerySourceReferenceExpression>();

                VisitBinaryQuerySourceReferenceExpression(expression.NodeType, querySource, constant);
            }
            else if (expression.HasExpressionOfType <MethodCallExpression>())
            {
                MethodCallExpression methodCall = expression.TryGetExpressionOfType <MethodCallExpression>();

                VisitBinaryMethodCallExpression(expression.NodeType, methodCall, constant);
            }
        }
Esempio n. 2
0
        protected override Expression VisitBinary(BinaryExpression binary)
        {
            switch (binary.NodeType)
            {
            case ExpressionType.Equal:
            case ExpressionType.NotEqual:
            case ExpressionType.GreaterThan:
            case ExpressionType.GreaterThanOrEqual:
            case ExpressionType.LessThan:
            case ExpressionType.LessThanOrEqual:
            {
                if (binary.HasExpressionOfType <ConstantExpression>())
                {
                    VisitBinaryConstantExpression(binary);
                }
                break;
            }

            case ExpressionType.AndAlso:
            {
                VisitBinaryAndAlsoExpression(binary);
                break;
            }

            case ExpressionType.OrElse:
            {
                VisitBinaryOrElseExpression(binary);
                break;
            }
            }

            return(binary);
        }