protected override SqlBinaryConstraint VisitSqlBinaryConstraint(SqlBinaryConstraint node) { var leftBinary = node.Left as SqlBinaryConstraint; var rightBinary = node.Right as SqlBinaryConstraint; var isLeftOr = leftBinary != null && leftBinary.Opeartor == SqlBinaryConstraintType.Or; var isRightOr = rightBinary != null && rightBinary.Opeartor == SqlBinaryConstraintType.Or; switch (node.Opeartor) { case SqlBinaryConstraintType.And: if (isLeftOr) _sql.Append("("); this.Visit(node.Left); if (isLeftOr) _sql.Append(")"); _sql.AppendAnd(); if (isRightOr) _sql.Append("("); this.Visit(node.Right); if (isRightOr) _sql.Append(")"); break; case SqlBinaryConstraintType.Or: this.Visit(node.Left); _sql.AppendOr(); this.Visit(node.Right); break; default: throw new NotSupportedException(); } return node; }
protected virtual SqlBinaryConstraint VisitSqlBinaryConstraint(SqlBinaryConstraint node) { this.Visit(node.Left); this.Visit(node.Right); return node; }
protected virtual SqlBinaryConstraint VisitSqlBinaryConstraint(SqlBinaryConstraint node) { this.Visit(node.Left); this.Visit(node.Right); return(node); }
private static ISqlConstraint AppendWhere(ISqlConstraint old, ISqlConstraint newConstraint) { if (old != null) { newConstraint = new SqlBinaryConstraint { Left = old, Opeartor = SqlBinaryConstraintType.And, Right = newConstraint }; } return newConstraint; }