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(sized)

float

FLOAT(p)

float

DOUBLE(sized)

double

DOUBLE PRECISION(sized)

double

DECIMAL(sized)

decimal

DEC(sized)

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  [ (ps) ], decimal [ (ps) ]

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值