CSRobot gen:mysql,pg-c#类型映射
2022/2/4 19:27:10
本文主要是介绍CSRobot gen:mysql,pg-c#类型映射,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
下面的数据库类型和c#类型的映射关系,只是我个人的想法,应该不同的业务场景对应可能不一样,比如json,xml,line,polygon结构化的数据,如果在C#中有对应的实体类,可以很友好的转换,如果没有,可以用现有的类型存储,再作转换,比如json,xml都可以用string来接收。
mysql字段类型和c#类型对应
Data type |
C# |
CHAR(size) |
string |
VARCHAR(size) |
string |
BINARY(size) |
byte[],object |
VARBINARY(size) |
byte[],object |
TINYBLOB |
btye[],object |
TINYTEXT |
string |
TEXT(size) |
string |
BLOB(size) |
byte[],object |
MEDIUMTEXT |
string |
MEDIUMBLOB |
byte[],object |
LONGTEXT |
string |
LONGBLOB |
byte[],object |
ENUM(val1, val2, val3, ...) |
string |
SET(val1, val2, val3, ...) |
object |
BIT(size) |
bit |
TINYINT(size) |
byte |
BOOL |
bool |
BOOLEAN |
bool |
SMALLINT(size) |
short |
MEDIUMINT(size) |
short |
INT(size) |
int32 |
INTEGER(size) |
int32 |
BIGINT(size) |
long |
FLOAT(size, d) |
float |
FLOAT(p) |
float |
DOUBLE(size, d) |
double |
DOUBLE PRECISION(size, d) |
double |
DECIMAL(size, d) |
decimal |
DEC(size, d) |
decimal |
DATE |
DateTime |
DATETIME(fsp) |
DateTime |
TIMESTAMP(fsp) |
DateTime |
TIME(fsp) |
DateTime |
YEAR |
short |
postgres字段类型和c#类型对应关系
Name |
C# |
Bigint, int8 |
long |
Bigserial, serial8 |
long |
bit [ (n) ] |
bit[] |
bit varying [ (n) ], varbit [ (n) ] |
bit[] |
Boolean, bool |
bool |
box |
object |
bytea |
byte[] |
character [ (n) ], char [ (n) ] |
string |
character varying [ (n) ], varchar [ (n) ] |
string |
cidr |
object |
circle |
object |
date |
DateTime |
double precision, float8 |
double |
inet |
object |
Integer, int, int4 |
int |
interval [ fields ] [ (p) ] |
string |
json |
string |
jsonb |
string |
line |
object |
lseg |
object |
macaddr |
object |
macaddr8 |
object |
money |
Decimal |
numeric [ (p, s) ], decimal [ (p, s) ] |
decimal |
path |
object |
pg_lsn |
object |
pg_snapshot |
object |
point |
object |
polygon |
object |
Real, float4 |
float |
Smallint, int2 |
Short |
Smallserial, serial2 |
short |
Serial, serial4 |
int |
text |
string |
time [ (p) ] [ without time zone ] |
DateTime |
time [ (p) ] with time zone, timetz |
DateTimeOffset |
timestamp [ (p) ] [ without time zone ] |
DateTime |
timestamp [ (p) ] with time zone, timestamptz |
DateTimeOffset |
tsquery |
object |
tsvector |
object |
txid_snapshot |
object |
uuid |
GUID |
xml |
string |
这篇关于CSRobot gen:mysql,pg-c#类型映射的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2022-03-01沐雪多租宝商城源码从.NetCore3.1升级到.Net6的步骤
- 2024-12-06使用Microsoft.Extensions.AI在.NET中生成嵌入向量
- 2024-11-18微软研究:RAG系统的四个层次提升理解与回答能力
- 2024-11-15C#中怎么从PEM格式的证书中提取公钥?-icode9专业技术文章分享
- 2024-11-14云架构设计——如何用diagrams.net绘制专业的AWS架构图?
- 2024-05-08首个适配Visual Studio平台的国产智能编程助手CodeGeeX正式上线!C#程序员必备效率神器!
- 2024-03-30C#设计模式之十六迭代器模式(Iterator Pattern)【行为型】
- 2024-03-29c# datetime tryparse
- 2024-02-21list find index c#
- 2024-01-24convert toint32 c#