PostgreSQL to .NET type mapping

前端之家收集整理的这篇文章主要介绍了PostgreSQL to .NET type mapping前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Postgresql to .NET type mapping

Type mapping rules from this table are used when generating a model from a database with Entity Data Model Wizard in Visual Studio 2008 - 2015 and Create Model Wizard in Entity Developer.

Postgresql data types

SSDL1

CSDL

.NET

boolean Boolean System.Boolean
smallint,int2 smallint Int16 System.Int16
integer,int4 int Int32 System.Int32
bigint,int8 bigint Int64 System.Int64
real Single System.Single
double precision,money double precision Double System.Double
numeric,decimal,float Decimal System.Decimal
date,timestamp,timestamp with time zone,timestamp without time zone DateTime System.DateTime
time,time with time zone,time without time zone,interval Time System.TimeSpan
timestamp with time zone datetimeoffset DateTimeOffset System.DateTimeOffset
char,varchar,text,citext,enum,bit,varbit,cidr,inet,macaddr,point,line,lseg,box,path,polygon,circle,xml*,character,character varying,bit varying,json,jsonb String System.String
bytea Binary System.Byte[]
uuid2 uuid Guid System.Guid
geometry3 spatial_geometry Geometry,GeometryCollection,GeometryLineString,GeometryMultiLineString,GeometryMultiPoint,GeometryMultiPolygon,GeometryPoint,GeometryPolygon System.Data.Spatial.DbGeometry
geography spatial_geography Geography,GeographyCollection,GeographyLineString,GeographyMultiLineString,GeographyMultiPoint,GeographyMultiPolygon,GeographyPoint,GeographyPolygon System.Data.Spatial.DbGeography

1Note that when mapping corresponding database data type,you will need the .NET type with larger precision. That is because,for example,any Int32 value can be stored in the NUMBER(10) column,but largest NUMBER(10) column value cannot be stored in the Int32 field,it requires Int64 field.

2Uuid and xml data types appeared in Postgresql 8.3.

3Supported in Entity Framework v5 and v6.

.NET to Postgresql default type mapping

.NET

CSDL

SSDL

PostgreSQL data types

System.Boolean boolean
System.Byte Byte byte smallint
System.Byte[] bytea
System.Data.Spatial.DbGeometry Geometry geometry
System.Data.Spatial.DbGeography Geography geography
System.DateTime timestamp timestamp
System.DateTimeOffset timestamp with time zone
System.Decimal numeric numeric
System.Double double precision
System.Guid uuid
System.Int16 System.Int32 integer
System.Int64 bigint
System.SByte SByte sbyte System.Single real
System.String
System.TimeSpan timestamp

2Supported in Entity Framework v5 and v6.

DateTimeOffcet type is not supported.

原文链接:https://www.f2er.com/postgresql/194429.html

猜你在找的Postgre SQL相关文章