PostgreSQL和C#的数据类型 [英] PostgreSQL and C# Datatypes

查看:1195
本文介绍了PostgreSQL和C#的数据类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索类型​​皈依表PostgreSQL和C#的,但我无法找到任何东西。
我会在上表中研究空单元格,如果我有时间。
但如果你知道网页里面有这些信息,我很适合你的帮助。

  Postgre类型---> C#类型BIGINT --->的Int64BIGSERIAL --->位[(N)]  - >字节]位变化[(N)] --->字节布尔--->布尔盒--->BYTEA --->字节]字符改变[(N)] --->串人物--->弦乐CIDR圈日期--->的DateTime双precision --->双INET整数--->的Int32间隔[(对)] --->时间跨度线LSEGMACADDR钱数字[(P,S)] --->十进制小数[(P,S)] --->十进制路径点多边形真正--->单SMALLINT --->的Int16串行文本 - >弦乐时间为(P)] [无时区] --->时间[(对)]与时区--->时间戳[(P)] [无时区] --->时间戳[(对)]与时区--->tsquery的tsvectortxid_snapshotUUID --->的GuidXML


解决方案

也许你能找到的东西翻翻的文档
Npgsql ,这是一个.NET数据提供PostgreSQL的。

的实施

文档的这一页实际上包含你正在寻找一个完整的表。搜索4.当前Npgsql状态 - 支持的数据类型。有一个很好的表在.NET中所有PostgreSQL数据类型及其记者。


PostgreSQL的NpgsqlDbType System.DbType枚举的.Net系统类型
---------- ------------ ------------------ ---------- ------
INT8 BIGINT的Int64 Int64的
布尔布尔布尔布尔
BYTEA bytea的二进制字节[]
日期日期日期日期时间
float8的双人双
INT4整数的Int32的Int32
钱生钱十进制小数
数字数字十进制小数
真个float4单人房
INT2 SMALLINT的Int16 Int16的
文字文本字符串字符串
时间时间时间日期时间
timetz时间时间日期时间
时间戳时间戳日期时间日期时间
timestamptz TimestampTZ日期时间日期时间
间隔间隔时间跨度对象
VARCHAR的Varchar字符串字符串
INET的Inet对象ip地址
比特位布尔布尔
UUID UUID的Guid的Guid
数组数组对象数组

I searched type convertion table between PostgreSQL and C#, but I couldn't find anything. I'll research empty cell on above table if I have time. But if you know the web page which has these information, I'm very appropriate to your help.

Postgre Type --->C# Type

bigint --->Int64

bigserial --->

bit [ (n) ] --->Byte[]

bit varying [ (n) ] --->Byte

boolean --->Boolean

box --->

bytea --->Byte[]

character varying [ (n) ] ---> String

character --->String

cidr

circle 

date --->DateTime

double precision --->Double

inet

integer --->Int32

interval [ (p) ] --->TimeSpan

line 

lseg 

macaddr

money

numeric [ (p, s) ] --->Decimal

decimal [ (p, s) ] --->Decimal

path  

point 

polygon 

real --->Single

smallint --->Int16

serial 

text --->String

time [ (p) ] [ without time zone ] --->

time [ (p) ] with time zone --->

timestamp [ (p) ] [ without time zone ] --->

timestamp [ (p) ] with time zone --->

tsquery 

tsvector 

txid_snapshot

uuid --->Guid

xml   

解决方案

Maybe you can find something looking through the documentation of Npgsql, which is an implementation of a .NET Data Provider for PostgreSQL.

This page of the documentation actually contains a complete table of what you are looking for. Search for "4. Current Npgsql Status" - "Supported data types". There is a nice table with all PostgreSQL data types and their correspondents in .NET.

Postgresql  NpgsqlDbType System.DbType Enum .Net System Type
----------  ------------ ------------------ ----------------
int8        Bigint       Int64              Int64
bool        Boolean      Boolean            Boolean
bytea       Bytea        Binary             Byte[]
date        Date         Date               DateTime
float8      Double       Double             Double
int4        Integer      Int32              Int32
money       Money        Decimal            Decimal
numeric     Numeric      Decimal            Decimal
float4      Real         Single             Single
int2        Smallint     Int16              Int16
text        Text         String             String
time        Time         Time               DateTime
timetz      Time         Time               DateTime
timestamp   Timestamp    DateTime           DateTime
timestamptz TimestampTZ  DateTime           DateTime
interval    Interval     Object             TimeSpan
varchar     Varchar      String             String
inet        Inet         Object             IPAddress
bit         Bit          Boolean            Boolean
uuid        Uuid         Guid               Guid
array       Array        Object             Array

这篇关于PostgreSQL和C#的数据类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆