2009-05-10 26 views
38

PostgreSQLとC#の間で型変換テーブルを検索しましたが、何も見つかりませんでした。 時間があれば上記の表の空のセルを調べます。 しかし、あなたがこれらの情報を持っているウェブページを知っているなら、私はあなたの助けに非常に適しています。PostgreSQLとC#のデータ型

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 

答えて

77

たぶん、あなたは、PostgreSQLのための.NETデータ・プロバイダの実装である Npgsqlの文書、を通して見ている何かを見つけることができます。

This page of the documentationには、実際にあなたが探しているものの完全な表が含まれています。 「4.現在のNpgsqlステータス」 - 「サポートされているデータ型」を検索します。 .NETには、PostgreSQLのすべてのデータ型とその特派員を持つ素敵なテーブルがあります。

 
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 
+1

大変ありがとうございました。 それはちょうど私が欲しいものです! – Higty

+0

あなたはようこそ! – splattne

+1

これが期限切れかどうかわかりませんが、DateTimeオブジェクトをPostgreSQLの「時刻」タイプに変換する際に問題が発生しました。 http://stackoverflow.com/questions/6129558/nhibernate-postgresql-datetime-to-time-conversion/6138382 PostgreSQLの時間オブジェクトとして保存するには、TimeSpanオブジェクトを使用する必要がありました。 –

関連する問題