예제 #1
0
        /// <summary>
        /// Visits the children of the <see cref="T:System.Linq.Expressions.UnaryExpression"/>.
        /// </summary>
        /// <returns>
        /// The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.
        /// </returns>
        /// <param name="node">The expression to visit.</param>
        protected override Expression VisitUnary(UnaryExpression node)
        {
            if (node.NodeType == ExpressionType.Not)
            {
                _serverWriter.NotOperater = true;
            }

            //if ((node.Operand is LambdaExpression) && (((LambdaExpression)node.Operand).Body is MemberExpression))
            //    base.Visit(node.Operand);

            if (!(node.Operand is MemberExpression))
            {
                return(base.VisitUnary(node));
            }

            Visit(node.Operand);

            if (node.Operand.Type.IsBoolean() && !node.Operand.IsHasValue())
            {
                _serverWriter.Boolean(!node.IsPredicate());
            }

            return(node);
        }