DbType与C#.NET数据类型(Type)对应关系
作者:C/S框架网|www.cscode.ne  发布日期:2021/06/08 10:49:59
  DbType与C#.NET数据类型(Type)对应关系

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




C/S框架网|原创精神.创造价值.打造精品

扫一扫加微信
C/S框架网作者微信 C/S框架网|原创作品.质量保障.竭诚为您服务

上一篇 下一篇