Skip to content

Mapping

shuxin edited this page Jul 12, 2022 · 5 revisions

类型映射

C# SqlServer MySql Oracle PostgreSQL SQLite
byte tinyint int NUMBER(3,0) int2 TINYINT
short smallint int NUMBER(5,0) int2 SMALLINT
int int int NUMBER(10,0) int4/serial4 INT/INTEGER
long bigint bigint NUMBER(19,0) int8/serial8 INT64
float float float BINARY_FLOAT float4 FLOAT
double real double BINARY_DOUBLE float8 DOUBLE
decimal decimal decimal NUMBER decimal NUMERIC
bool bit int NUMBER(10,0) boolean BOOL
DateTime datetime datetime TIMESTAMP timestamp DATETIME
string varchar/nvarchar varchar VARCHAR/NVARCHAR2 varchar VARCHAR/NVARCHAR
Guid uniqueidentifier varchar - uuid GUID
Enum int int NUMBER(10,0) int4 INT

以上为框架内置支持类型,如需扩展支持更多类型,请参考 demo https://github.com/shuxinqin/Chloe/blob/master/src/ChloeDemo/Program.cs#L61