protected override IExpression VisitBinary(BinaryExpression binaryExpression) { if ((object)binaryExpression == null) throw new ArgumentNullException(nameof(binaryExpression)); this.Strings.Append("("); this.Visit(binaryExpression.LeftExpression); switch (binaryExpression.BinaryOperator) { case BinaryOperator.Add: this.Strings.Append(" + "); break; case BinaryOperator.Sub: this.Strings.Append(" - "); break; case BinaryOperator.Div: this.Strings.Append(" / "); break; case BinaryOperator.Mul: this.Strings.Append(" * "); break; case BinaryOperator.Mod: this.Strings.Append(" % "); break; case BinaryOperator.And: this.Strings.Append(" AND "); break; case BinaryOperator.Or: this.Strings.Append(" OR "); break; case BinaryOperator.Eq: this.Strings.Append(" = "); break; case BinaryOperator.Ne: this.Strings.Append(" <> "); break; case BinaryOperator.Gt: this.Strings.Append(" > "); break; case BinaryOperator.Ge: this.Strings.Append(" >= "); break; case BinaryOperator.Lt: this.Strings.Append(" < "); break; case BinaryOperator.Le: this.Strings.Append(" <= "); break; case BinaryOperator.Like: this.Strings.Append(" LIKE "); break; default: throw new NotSupportedException(string.Format("The binary operator '{0}' is not supported.", binaryExpression.BinaryOperator)); } this.Visit(binaryExpression.RightExpression); this.Strings.Append(")"); return binaryExpression; }
protected abstract IExpression VisitBinary(BinaryExpression binaryExpression);