Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapper
提交
a09dcbd8
D
Dapper
项目概览
int
/
Dapper
12 个月 前同步成功
通知
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,发现更多精彩内容 >>
提交
a09dcbd8
编写于
4月 05, 2011
作者:
S
Sam Saffron
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
added massive with open connection
上级
3babf267
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
22 addition
and
1 deletion
+22
-1
Massive/Massive.cs
Massive/Massive.cs
+16
-0
PerformanceTests.cs
PerformanceTests.cs
+5
-0
SqlMapper.cs
SqlMapper.cs
+1
-1
未找到文件。
Massive/Massive.cs
浏览文件 @
a09dcbd8
...
...
@@ -123,6 +123,22 @@ public DynamicModel(string connectionString = "", string tableName = "", string
_factory
=
DbProviderFactories
.
GetFactory
(
_providerName
);
_connectionString
=
connectionString
;
}
public
virtual
List
<
dynamic
>
QueryHacked
(
string
sql
,
DbConnection
connection
,
params
object
[]
args
)
{
List
<
dynamic
>
list
=
new
List
<
dynamic
>();
using
(
var
rdr
=
CreateCommand
(
sql
,
connection
,
args
).
ExecuteReader
(
CommandBehavior
.
Default
))
while
(
rdr
.
Read
())
{
var
e
=
new
ExpandoObject
();
var
d
=
e
as
IDictionary
<
string
,
object
>;
for
(
var
i
=
0
;
i
<
rdr
.
FieldCount
;
i
++)
d
.
Add
(
rdr
.
GetName
(
i
),
rdr
[
i
]);
list
.
Add
(
e
);
}
return
list
;
}
/// <summary>
/// Enumerates the reader yielding the result - thanks to Jeroen Haegebaert
/// </summary>
...
...
PerformanceTests.cs
浏览文件 @
a09dcbd8
...
...
@@ -97,6 +97,11 @@ public void Run(int iterations)
var
massiveConnection
=
new
DynamicModel
(
Program
.
connectionString
);
tests
.
Add
(
id
=>
massiveConnection
.
Query
(
"select * from Posts where Id = @0"
,
id
).
ToList
(),
"Dynamic Massive ORM Query"
);
// Massive was hacked a bit to support an open connection, the intention is to add this to the API at some point
var
massiveConnection2
=
new
DynamicModel
(
Program
.
connectionString
);
var
hackedConnection
=
Program
.
GetOpenConnection
();
tests
.
Add
(
id
=>
massiveConnection
.
QueryHacked
(
"select * from Posts where Id = @0"
,
hackedConnection
,
id
).
ToList
(),
"Dynamic Massive ORM Query (hacked)"
);
// HAND CODED
...
...
SqlMapper.cs
浏览文件 @
a09dcbd8
...
...
@@ -252,7 +252,7 @@ private static IDbCommand SetupCommand(IDbConnection cnn, SqlTransaction tranact
foreach
(
var
info
in
paramInfo
)
{
var
param
=
new
SqlParameter
(
"@"
+
info
.
Name
,
info
.
Type
);
param
.
Value
=
info
.
Val
??
DBNull
.
Value
;
param
.
Direction
=
ParameterDirection
.
Input
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录