/// <summary> /// Clona el objeto ColumnConstraints en una nueva instancia. /// </summary> public ConstraintColumns Clone() { ConstraintColumns columns = new ConstraintColumns(this.Parent); for (int index = 0; index < this.Count; index++) { columns.Add(this[index].Clone()); } return(columns); }
/// <summary> /// Compara dos campos y devuelve true si son iguales, caso contrario, devuelve false. /// </summary> public static Boolean Compare(ConstraintColumns origin, ConstraintColumns destination) { if (destination == null) { throw new ArgumentNullException("destination"); } if (origin == null) { throw new ArgumentNullException("origin"); } if (origin.Count != destination.Count) { return(false); } for (int j = 0; j < origin.Count; j++) { ConstraintColumn item = destination[origin[j].FullName]; if (item == null) { return(false); } else if (!ConstraintColumn.Compare(origin[j], item)) { return(false); } } for (int j = 0; j < destination.Count; j++) { ConstraintColumn item = origin[destination[j].FullName]; if (item == null) { return(false); } else if (!ConstraintColumn.Compare(destination[j], item)) { return(false); } } return(true); }
/// <summary> /// Compara dos campos y devuelve true si son iguales, caso contrario, devuelve false. /// </summary> public static Boolean Compare(Constraint origin, Constraint destination) { if (destination == null) { throw new ArgumentNullException("destination"); } if (origin == null) { throw new ArgumentNullException("origin"); } if (origin.NotForReplication != destination.NotForReplication) { return(false); } if ((origin.RelationalTableFullName == null) && (destination.RelationalTableFullName != null)) { return(false); } if (origin.RelationalTableFullName != null) { if (!origin.RelationalTableFullName.Equals(destination.RelationalTableFullName, StringComparison.CurrentCultureIgnoreCase)) { return(false); } } if ((origin.Definition == null) && (destination.Definition != null)) { return(false); } if (origin.Definition != null) { if ((!origin.Definition.Equals(destination.Definition)) && (!origin.Definition.Equals("(" + destination.Definition + ")"))) { return(false); } } /*Solo si la constraint esta habilitada, se chequea el is_trusted*/ if (!destination.IsDisabled) { if (origin.WithNoCheck != destination.WithNoCheck) { return(false); } } if (origin.OnUpdateCascade != destination.OnUpdateCascade) { return(false); } if (origin.OnDeleteCascade != destination.OnDeleteCascade) { return(false); } if (!ConstraintColumns.Compare(origin.Columns, destination.Columns)) { return(false); } if ((origin.Index != null) && (destination.Index != null)) { return(Index.Compare(origin.Index, destination.Index)); } return(true); }