Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapper
提交
46ed9883
D
Dapper
项目概览
int
/
Dapper
11 个月 前同步成功
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Dapper
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
46ed9883
编写于
3月 12, 2012
作者:
D
David Chell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Added test for Posgresql Array parameters
上级
eed8b6f5
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
54 addition
and
2 deletion
+54
-2
Tests/DapperTests.csproj
Tests/DapperTests.csproj
+4
-1
Tests/Tests.cs
Tests/Tests.cs
+50
-1
未找到文件。
Tests/DapperTests.csproj
浏览文件 @
46ed9883
...
@@ -65,6 +65,9 @@
...
@@ -65,6 +65,9 @@
<Reference
Include=
"NHibernate.ByteCode.LinFu"
>
<Reference
Include=
"NHibernate.ByteCode.LinFu"
>
<HintPath>
NHibernate\NHibernate.ByteCode.LinFu.dll
</HintPath>
<HintPath>
NHibernate\NHibernate.ByteCode.LinFu.dll
</HintPath>
</Reference>
</Reference>
<Reference
Include=
"Npgsql"
>
<HintPath>
..\..\..\WebSites\PoolBooking\bin\Npgsql.dll
</HintPath>
</Reference>
<Reference
Include=
"ServiceStack.Common, Version=1.0.4110.36238, Culture=neutral, processorArchitecture=MSIL"
>
<Reference
Include=
"ServiceStack.Common, Version=1.0.4110.36238, Culture=neutral, processorArchitecture=MSIL"
>
<SpecificVersion>
False
</SpecificVersion>
<SpecificVersion>
False
</SpecificVersion>
<HintPath>
OrmLite\ServiceStack.Common.dll
</HintPath>
<HintPath>
OrmLite\ServiceStack.Common.dll
</HintPath>
...
@@ -183,7 +186,7 @@
...
@@ -183,7 +186,7 @@
<LastGenOutput>
DataClasses.designer.cs
</LastGenOutput>
<LastGenOutput>
DataClasses.designer.cs
</LastGenOutput>
<SubType>
Designer
</SubType>
<SubType>
Designer
</SubType>
</None>
</None>
<None
Include=
"packages.config"
/>
<None
Include=
"packages.config"
/>
<None
Include=
"Properties\Settings.settings"
>
<None
Include=
"Properties\Settings.settings"
>
<Generator>
SettingsSingleFileGenerator
</Generator>
<Generator>
SettingsSingleFileGenerator
</Generator>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
<LastGenOutput>
Settings.Designer.cs
</LastGenOutput>
...
...
Tests/Tests.cs
浏览文件 @
46ed9883
using
System
;
#
define
POSTGRESQL
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Data.SqlClient
;
using
System.Data.SqlClient
;
using
System.Linq
;
using
System.Linq
;
...
@@ -8,6 +9,10 @@
...
@@ -8,6 +9,10 @@
using
System.Data
;
using
System.Data
;
using
System.Collections
;
using
System.Collections
;
using
System.Reflection
;
using
System.Reflection
;
#if POSTGRESQL
using
Dapper.Contrib.Extensions
;
using
Npgsql
;
#endif
namespace
SqlMapper
namespace
SqlMapper
{
{
...
@@ -1335,5 +1340,49 @@ public enum ShortEnum : short
...
@@ -1335,5 +1340,49 @@ public enum ShortEnum : short
{
{
Zero
=
0
,
One
=
1
,
Two
=
2
,
Three
=
3
,
Four
=
4
,
Five
=
5
,
Six
=
6
Zero
=
0
,
One
=
1
,
Two
=
2
,
Three
=
3
,
Four
=
4
,
Five
=
5
,
Six
=
6
}
}
#if POSTGRESQL
[
Table
(
"tcat"
)]
class
Cat
{
[
Key
]
public
int
Id
{
get
;
set
;
}
public
string
Breed
{
get
;
set
;
}
public
string
Name
{
get
;
set
;
}
}
Cat
[]
Cats
=
{
new
Cat
()
{
Breed
=
"Abyssinian"
,
Name
=
"KACTUS"
},
new
Cat
()
{
Breed
=
"Aegean cat"
,
Name
=
"KADAFFI"
},
new
Cat
()
{
Breed
=
"American Bobtail"
,
Name
=
"KANJI"
},
new
Cat
()
{
Breed
=
"Balinese"
,
Name
=
"MACARONI"
},
new
Cat
()
{
Breed
=
"Bombay"
,
Name
=
"MACAULAY"
},
new
Cat
()
{
Breed
=
"Burmese"
,
Name
=
"MACBETH"
},
new
Cat
()
{
Breed
=
"Chartreux"
,
Name
=
"MACGYVER"
},
new
Cat
()
{
Breed
=
"German Rex"
,
Name
=
"MACKENZIE"
},
new
Cat
()
{
Breed
=
"Javanese"
,
Name
=
"MADISON"
},
new
Cat
()
{
Breed
=
"Persian"
,
Name
=
"MAGNA"
}
};
public
void
TestPostresqlArrayParameters
()
{
using
(
var
conn
=
new
NpgsqlConnection
(
"Server=localhost;Port=5432;User Id=dappertest;Password=dapperpass;Database=dappertest;Encoding=UNICODE"
))
{
conn
.
Open
();
IDbTransaction
transaction
=
conn
.
BeginTransaction
();
conn
.
Execute
(
"create table tcat ( id serial not null, breed character varying(20) not null, name character varying (20) not null);"
);
foreach
(
var
cat
in
Cats
)
conn
.
Insert
(
cat
);
var
r
=
conn
.
Query
<
Cat
>(
"select * from tcat where id=any(:catids)"
,
new
{
catids
=
new
[]
{
1
,
3
,
5
}
});
r
.
Count
().
IsEqualTo
(
3
);
r
.
Count
(
c
=>
c
.
Id
==
1
).
IsEqualTo
(
1
);
r
.
Count
(
c
=>
c
.
Id
==
3
).
IsEqualTo
(
1
);
r
.
Count
(
c
=>
c
.
Id
==
5
).
IsEqualTo
(
1
);
transaction
.
Rollback
();
}
}
#endif
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录