Example #1
0
        /// <summary>
        /// Visits the children of the <see cref="T:System.Linq.Expressions.BinaryExpression"/>.
        /// </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 VisitBinary(BinaryExpression node)
        {
            var        op    = node.GetOperator();
            Expression left  = node.Left;
            Expression right = node.Right;

            _serverWriter.OpenBrace();

            if (left.Type.IsBoolean())
            {
                Visit(left);
                _serverWriter.WhiteSpace();
                _serverWriter.Write(op);
                _serverWriter.WhiteSpace();
                Visit(right);
            }
            else
            {
                VisitValue(left);
                _serverWriter.WhiteSpace();
                _serverWriter.Write(op);
                _serverWriter.WhiteSpace();
                VisitValue(right);
            }

            _serverWriter.CloseBrace();

            return(node);
        }