public override ODataExpression VisitBinary(ODataBinaryExpression expr)
        {
            this.sqlBuilder.Append("(");
            this.Visit(expr.Left);
            switch (expr.ExpressionType)
            {
                case ExpressionType.AndAlso:
                    this.sqlBuilder.Append(" AND ");
                    break;
                case ExpressionType.OrElse:
                    this.sqlBuilder.Append(" OR ");
                    break;
                case ExpressionType.Equal:
                    this.sqlBuilder.Append(" == ");
                    break;
                case ExpressionType.NotEqual:
                    this.sqlBuilder.Append(" != ");
                    break;
                case ExpressionType.LessThan:
                    this.sqlBuilder.Append(" < ");
                    break;
                case ExpressionType.LessThanOrEqual:
                    this.sqlBuilder.Append(" <= ");
                    break;
                case ExpressionType.GreaterThan:
                    this.sqlBuilder.Append(" > ");
                    break;
                case ExpressionType.GreaterThanOrEqual:
                    this.sqlBuilder.Append(" >= ");
                    break;
                case ExpressionType.Add:
                    this.sqlBuilder.Append(" + ");
                    break;
                case ExpressionType.Subtract:
                    this.sqlBuilder.Append(" - ");
                    break;
                case ExpressionType.Multiply:
                    this.sqlBuilder.Append(" * ");
                    break;
                case ExpressionType.Divide:
                    this.sqlBuilder.Append(" / ");
                    break;
                case ExpressionType.Modulo:
                    this.sqlBuilder.Append(" % ");
                    break;
                default:
                    throw new NotSupportedException();
            }
            this.Visit(expr.Right);
            this.sqlBuilder.Append(")");

            return expr;
        }
        public virtual ODataExpression VisitBinary(ODataBinaryExpression expr)
        {
            ODataExpression left = null;
            ODataExpression right = null;

            if (expr.Left != null)
            {
                left = this.Visit(expr.Left);
            }
            if (expr.Right != null)
            {
                right = this.Visit(expr.Right);
            }
            if (left != expr.Left || right != expr.Right)
            {
                return new ODataBinaryExpression(left, right);
            }

            return expr;
        }
 public static ODataExpression Divide(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.Divide;
     return bex;
 }
 public static ODataExpression Multiply(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.Multiply;
     return bex;
 }
 public static ODataExpression AndAlso(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.AndAlso;
     return bex;
 }
 public static ODataExpression Subtract(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.Subtract;
     return bex;
 }
 public static ODataExpression LessThanOrEqual(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.LessThanOrEqual;
     return bex;
 }
 public static ODataExpression GreaterThan(ODataExpression left, ODataExpression right)
 {
     ODataBinaryExpression bex = new ODataBinaryExpression(left, right);
     bex.ExpressionType = ExpressionType.GreaterThan;
     return bex;
 }