在使用.net core web api 编写接口时,小白常常会卡在Mysql数据类型转换成C#这一步。而且网上的资料大多不全,查找起来十分的浪费功夫。
下面就是本小白初学时整理的对照表:
Mysql | C# |
---|---|
bigint | long |
bigint unsigned | ulong |
int | int |
int unsigned | uint |
smallint | short |
smallint unsigned | ushort |
guid | Guid |
smalldatetime、date、datetime、timestamp | DateTime |
float | float |
double | double |
numeric、smallmoney、decimal、money | decimal |
bit、boolean、bool | bool |
tinyint | byte |
tinyint unsigned | sbyte |
varbinary、longblob、mediumblob、blob、binary、image | byte[] |
如有错误,欢迎指正~