using System;
using System.ComponentModel;
using System.Data;
namespace MJTop.Data
{
///
/// 列信息
///
[Serializable]
public class ColumnInfo
{
///
/// 序号
///
[DisplayName("序号")]
public int Colorder
{
get;
set;
}
///
/// 列名
///
[DisplayName("列名")]
public string ColumnName
{
get;
set;
}
///
/// 数据类型
///
[DisplayName("数据类型")]
public string TypeName
{
get;
set;
}
///
/// 列说明
///
[DisplayName("列说明")]
public string DeText
{
get;
set;
}
///
/// 字段长度 max 或特殊数据类型 使用 -1 表示!
///
[DisplayName("长度")]
public long? Length
{
get;
set;
}
///
/// 小数点后保留位数
///
[DisplayName("小数位数")]
public int? Scale
{
get;
set;
}
///
/// 是否自增列
///
[DisplayName("是否为自增")]
public bool IsIdentity
{
get;
set;
}
///
/// 是否主键
///
[DisplayName("是否为主键")]
public bool IsPK
{
get;
set;
}
///
/// 是否可为Null
///
[DisplayName("是否可为空")]
public bool CanNull
{
get;
set;
}
///
/// 默认值
///
[DisplayName("默认值")]
public string DefaultVal
{
get;
set;
}
///
/// 近似类型
///
[DisplayName("近似类型")]
public LikeType LikeType
{
get
{
if (this.DbType == DbType.Decimal || this.DbType == DbType.Double
|| this.DbType == DbType.Int16
|| this.DbType == DbType.Int32
|| this.DbType == DbType.Int64
)
{
return LikeType.Number;
}
else if (this.DbType == DbType.Date || this.DbType == DbType.DateTime
|| this.DbType == DbType.DateTime2 || this.DbType == DbType.DateTimeOffset)
{
return LikeType.DateTime;
}
else
{
return LikeType.String;
}
}
}
///
/// DbType类型
///
[DisplayName("DbType类型")]
public DbType DbType
{
get;
set;
}
}
}