You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
2.1 KiB

using System;
using OpenDBDiff.Schema.Model;
namespace OpenDBDiff.Schema.SQLServer.Generates.Model
{
public class IndexColumn : SQLServerSchemaBase, IComparable<IndexColumn>
{
public IndexColumn(ISchemaBase parentObject)
: base(parentObject, ObjectType.IndexColumn)
{
}
public new IndexColumn Clone(ISchemaBase parent)
{
IndexColumn column = new IndexColumn(parent);
column.Id = this.Id;
column.IsIncluded = this.IsIncluded;
column.Name = this.Name;
column.Order = this.Order;
column.Status = this.Status;
column.KeyOrder = this.KeyOrder;
column.DataTypeId = this.DataTypeId;
return column;
}
public int DataTypeId { get; set; }
public int KeyOrder { get; set; }
public Boolean IsIncluded { get; set; }
public Boolean Order { get; set; }
public static Boolean Compare(IndexColumn origin, IndexColumn destination)
{
if (destination == null) throw new ArgumentNullException("destination");
if (origin == null) throw new ArgumentNullException("origin");
if (origin.IsIncluded != destination.IsIncluded) return false;
if (origin.Order != destination.Order) return false;
if (origin.KeyOrder != destination.KeyOrder) return false;
return true;
}
public override string ToSqlDrop()
{
return "";
}
public override string ToSqlAdd()
{
return "";
}
public override string ToSql()
{
return "";
}
public int CompareTo(IndexColumn other)
{
/*if (other.Name.Equals(this.Name))
{*/
if (other.IsIncluded == this.IsIncluded)
return this.KeyOrder.CompareTo(other.KeyOrder);
else
return other.IsIncluded.CompareTo(this.IsIncluded);
/*}
else
return this.Name.CompareTo(other.Name);*/
}
}
}