示例#1
0
        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;
        }
示例#2
0
 protected virtual SqlBinaryConstraint VisitSqlBinaryConstraint(SqlBinaryConstraint node)
 {
     this.Visit(node.Left);
     this.Visit(node.Right);
     return node;
 }
示例#3
0
 protected virtual SqlBinaryConstraint VisitSqlBinaryConstraint(SqlBinaryConstraint node)
 {
     this.Visit(node.Left);
     this.Visit(node.Right);
     return(node);
 }
示例#4
0
 private static ISqlConstraint AppendWhere(ISqlConstraint old, ISqlConstraint newConstraint)
 {
     if (old != null)
     {
         newConstraint = new SqlBinaryConstraint
         {
             Left = old,
             Opeartor = SqlBinaryConstraintType.And,
             Right = newConstraint
         };
     }
     return newConstraint;
 }