using System; namespace ZeroLevel.SqlServer { public class ColumnInfo: IEquatable { /// /// Наименование поля /// public string Name { get; set; } /// /// Тип поля в рамках базы данных /// public string DbType; /// /// Тип поля в рамках .NET /// public Type DotNetType; /// /// Указывает что поле является ключом таблицы /// public bool IsPrimaryKey; /// /// Указывает, разрешены ли значения NULL в поле /// public bool AllowNull; /// /// Размер в байтах (если применимо) /// public long Size; /// /// Указывает что поле является автоинкрементируемым /// public bool AutoInc; public ColumnInfo() { } public ColumnInfo(ColumnInfo other) { Name = other.Name; DbType = other.DbType; DotNetType = other.DotNetType; IsPrimaryKey = other.IsPrimaryKey; AllowNull = other.AllowNull; Size = other.Size; AutoInc = other.AutoInc; } public bool Equals(ColumnInfo other) { bool eq = true; eq &= AutoInc == other.AutoInc; eq &= Size == other.Size; eq &= AllowNull == other.AllowNull; eq &= IsPrimaryKey == other.IsPrimaryKey; eq &= String.Compare(DbType, other.DbType, StringComparison.OrdinalIgnoreCase) == 0; eq &= String.Compare(Name, other.Name, StringComparison.OrdinalIgnoreCase) == 0; eq &= DotNetType.Equals(other.DotNetType); return eq; } } }