DbType与C#.NET数据类型(Type)对应关系


C# Code:
/// <summary>
/// DbType与.NET数据类型对应关系
/// </summary>
public static IDictionary<DbType, Type> DbType2NetTypeMapping
{
get
{
IDictionary<DbType, Type> map = new Dictionary<DbType, Type>();
map.Add(DbType.AnsiString, typeof(System.String));
map.Add(DbType.AnsiStringFixedLength, typeof(System.String));
map.Add(DbType.Binary, typeof(System.Byte[]));
map.Add(DbType.Boolean, typeof(System.Boolean));
map.Add(DbType.Byte, typeof(System.Byte));
map.Add(DbType.Currency, typeof(System.Decimal));
map.Add(DbType.Date, typeof(System.DateTime));
map.Add(DbType.DateTime, typeof(System.DateTime));
map.Add(DbType.DateTime2, typeof(System.DateTime));
map.Add(DbType.DateTimeOffset, typeof(System.DateTimeOffset));
map.Add(DbType.Decimal, typeof(System.Decimal));
map.Add(DbType.Double, typeof(System.Double));
map.Add(DbType.Guid, typeof(System.Guid));
map.Add(DbType.Int16, typeof(System.Int16));
map.Add(DbType.Int32, typeof(System.Int32));
map.Add(DbType.Int64, typeof(System.Int64));
map.Add(DbType.Object, typeof(System.Object));
map.Add(DbType.SByte, typeof(System.SByte));
map.Add(DbType.Single, typeof(System.Single));
map.Add(DbType.String, typeof(System.String));
map.Add(DbType.StringFixedLength, typeof(System.String));
map.Add(DbType.Time, typeof(System.DateTime));
map.Add(DbType.UInt16, typeof(System.UInt16));
map.Add(DbType.UInt32, typeof(System.UInt32));
map.Add(DbType.UInt64, typeof(System.UInt64));
map.Add(DbType.VarNumeric, typeof(System.Decimal));
map.Add(DbType.Xml, typeof(System.String));
return map;
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761
/// <summary>
/// DbType与.NET数据类型对应关系
/// </summary>
public static IDictionary<DbType, Type> DbType2NetTypeMapping
{
get
{
IDictionary<DbType, Type> map = new Dictionary<DbType, Type>();
map.Add(DbType.AnsiString, typeof(System.String));
map.Add(DbType.AnsiStringFixedLength, typeof(System.String));
map.Add(DbType.Binary, typeof(System.Byte[]));
map.Add(DbType.Boolean, typeof(System.Boolean));
map.Add(DbType.Byte, typeof(System.Byte));
map.Add(DbType.Currency, typeof(System.Decimal));
map.Add(DbType.Date, typeof(System.DateTime));
map.Add(DbType.DateTime, typeof(System.DateTime));
map.Add(DbType.DateTime2, typeof(System.DateTime));
map.Add(DbType.DateTimeOffset, typeof(System.DateTimeOffset));
map.Add(DbType.Decimal, typeof(System.Decimal));
map.Add(DbType.Double, typeof(System.Double));
map.Add(DbType.Guid, typeof(System.Guid));
map.Add(DbType.Int16, typeof(System.Int16));
map.Add(DbType.Int32, typeof(System.Int32));
map.Add(DbType.Int64, typeof(System.Int64));
map.Add(DbType.Object, typeof(System.Object));
map.Add(DbType.SByte, typeof(System.SByte));
map.Add(DbType.Single, typeof(System.Single));
map.Add(DbType.String, typeof(System.String));
map.Add(DbType.StringFixedLength, typeof(System.String));
map.Add(DbType.Time, typeof(System.DateTime));
map.Add(DbType.UInt16, typeof(System.UInt16));
map.Add(DbType.UInt32, typeof(System.UInt32));
map.Add(DbType.UInt64, typeof(System.UInt64));
map.Add(DbType.VarNumeric, typeof(System.Decimal));
map.Add(DbType.Xml, typeof(System.String));
return map;
}
}
//来源:C/S框架网 | www.csframework.com | QQ:23404761

扫一扫加微信


版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网