MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型
作者:C/S框架网|www.cscode.ne  发布日期:2021/06/08 11:11:34
  MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型


MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型



C# Code:

/// <summary>
/// MySql数据类型(如:varchar)对应DbType类型
/// MySQL数据类型(MySqlDbType)数据类型名称对应DbType类型
/// </summary>
public static IDictionary<string, DbType> MySqlDbTypeName2DbTypeMapping
{
  
get
  {
    IDictionary
<string, DbType> map = new Dictionary<string, DbType>();
    map.Add(
"BigInt", DbType.Int64);
    map.Add(
"Binary", DbType.Binary);
    map.Add(
"Bit", DbType.Boolean);
    map.Add(
"Blob", DbType.Binary);
    map.Add(
"Char", DbType.AnsiStringFixedLength);
    map.Add(
"Byte", DbType.Byte);
    map.Add(
"Date", DbType.Date);
    map.Add(
"DateTime", DbType.DateTime);
    map.Add(
"Decimal", DbType.Decimal);
    map.Add(
"Double", DbType.Double);
    map.Add(
"Enum", DbType.String);//enum可以自定义类型,常用的是0,1,也可以定义为boy,girl,secret
    
map.Add("Float", DbType.Double);
    map.Add(
"Geometry", DbType.Object);
    map.Add(
"Guid", DbType.Guid);
    map.Add(
"Int", DbType.Int32);
    map.Add(
"Integer", DbType.Int32);
    map.Add(
"Int16", DbType.Int16);
    map.Add(
"Int24", DbType.Int32);
    map.Add(
"Int32", DbType.Int32);
    map.Add(
"Int64", DbType.Int64);
    map.Add(
"JSON", DbType.String);
    map.Add(
"LongBlob", DbType.Binary);
    map.Add(
"LongText", DbType.String);
    map.Add(
"MediumBlob", DbType.Binary);
    map.Add(
"MediumText", DbType.String);
    map.Add(
"Newdate", DbType.DateTime);
    map.Add(
"NewDecimal", DbType.Decimal);
    map.Add(
"Numeric", DbType.Decimal);
    map.Add(
"Real", DbType.Double);
    map.Add(
"Set", DbType.String);
    map.Add(
"String", DbType.String);
    map.Add(
"SmallInt", DbType.Int16);
    map.Add(
"Text", DbType.String);
    map.Add(
"Time", DbType.Time);
    map.Add(
"Timestamp", DbType.DateTime);
    map.Add(
"TinyBlob", DbType.Binary);
    map.Add(
"TinyInt", DbType.Int16);
    map.Add(
"TinyText", DbType.String);
    map.Add(
"UByte", DbType.Byte);
    map.Add(
"UInt16", DbType.UInt16);
    map.Add(
"UInt24", DbType.UInt32);
    map.Add(
"UInt32", DbType.UInt32);
    map.Add(
"UInt64", DbType.UInt64);
    map.Add(
"VarBinary", DbType.Binary);
    map.Add(
"VarChar", DbType.String);
    map.Add(
"VarString", DbType.String);
    map.Add(
"Year", DbType.Int32);
    
return map;
  }
}


//来源:C/S框架网 | www.csframework.com | QQ:23404761




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

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

上一篇 下一篇