using System; namespace OpenDBDiff.Schema.SQLServer.Generates.Model { public class ConstraintColumn : SQLServerSchemaBase, IComparable { public ConstraintColumn(Constraint parentObject) : base(parentObject, ObjectType.ConstraintColumn) { } public ConstraintColumn Clone() { ConstraintColumn ccol = new ConstraintColumn((Constraint)this.Parent); ccol.ColumnRelationalName = this.ColumnRelationalName; ccol.ColumnRelationalId = this.ColumnRelationalId; ccol.Name = this.Name; ccol.IsIncluded = this.IsIncluded; ccol.Order = this.Order; ccol.KeyOrder = this.KeyOrder; ccol.Id = this.Id; ccol.DataTypeId = this.DataTypeId; ccol.ColumnRelationalDataTypeId = this.ColumnRelationalDataTypeId; return ccol; } public int DataTypeId { get; set; } public int ColumnRelationalDataTypeId { get; set; } public int ColumnRelationalId { get; set; } /// /// Gets or sets the column key order in the index. /// /// The key order. public int KeyOrder { get; set; } /// /// Gets or sets a value indicating whether this column is included in the index leaf page. /// /// /// true if this column is included; otherwise, false. /// public Boolean IsIncluded { get; set; } /// /// Orden de la columna (Ascendente o Descendente). Se usa solo en Primary Keys. /// public Boolean Order { get; set; } public string ColumnRelationalName { get; set; } public override string ToSqlDrop() { return ""; } public override string ToSqlAdd() { return ""; } public override string ToSql() { return ""; } public static Boolean Compare(ConstraintColumn origin, ConstraintColumn destination) { if (destination == null) throw new ArgumentNullException("destination"); if (origin == null) throw new ArgumentNullException("origin"); if ((origin.ColumnRelationalName == null) && (destination.ColumnRelationalName != null)) return false; if (origin.ColumnRelationalName != null) { if (!origin.ColumnRelationalName.Equals(destination.ColumnRelationalName, StringComparison.CurrentCultureIgnoreCase)) return false; } if (origin.IsIncluded != destination.IsIncluded) return false; if (origin.Order != destination.Order) return false; if (origin.KeyOrder != destination.KeyOrder) return false; return true; } public int CompareTo(ConstraintColumn other) { return this.ColumnRelationalId.CompareTo(other.ColumnRelationalId); } } }