Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
int
Dapper
提交
04ba42fb
D
Dapper
项目概览
int
/
Dapper
大约 1 年 前同步成功
通知
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,发现更多精彩内容 >>
提交
04ba42fb
编写于
9月 15, 2014
作者:
M
Marc Gravell
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Removed unnecessary async/await; addded ConfigureAwait to the remainder
上级
4153d2d8
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
24 addition
and
24 deletion
+24
-24
Dapper.Rainbow NET45/DatabaseAsync.cs
Dapper.Rainbow NET45/DatabaseAsync.cs
+24
-24
未找到文件。
Dapper.Rainbow NET45/DatabaseAsync.cs
浏览文件 @
04ba42fb
...
...
@@ -29,7 +29,7 @@ public partial class Table<T, TId>
string
cols_params
=
string
.
Join
(
","
,
paramNames
.
Select
(
p
=>
"@"
+
p
));
var
sql
=
"set nocount on insert "
+
TableName
+
" ("
+
cols
+
") values ("
+
cols_params
+
") select cast(scope_identity() as int)"
;
return
(
await
database
.
QueryAsync
<
int
?>(
sql
,
o
)).
Single
();
return
(
await
database
.
QueryAsync
<
int
?>(
sql
,
o
)
.
ConfigureAwait
(
false
)
).
Single
();
}
/// <summary>
...
...
@@ -38,7 +38,7 @@ public partial class Table<T, TId>
/// <param name="id"></param>
/// <param name="data"></param>
/// <returns></returns>
public
async
Task
<
int
>
UpdateAsync
(
TId
id
,
dynamic
data
)
public
Task
<
int
>
UpdateAsync
(
TId
id
,
dynamic
data
)
{
List
<
string
>
paramNames
=
GetParamNames
((
object
)
data
);
...
...
@@ -50,7 +50,7 @@ public async Task<int> UpdateAsync(TId id, dynamic data)
DynamicParameters
parameters
=
new
DynamicParameters
(
data
);
parameters
.
Add
(
"Id"
,
id
);
return
await
database
.
ExecuteAsync
(
builder
.
ToString
(),
parameters
);
return
database
.
ExecuteAsync
(
builder
.
ToString
(),
parameters
);
}
/// <summary>
...
...
@@ -60,7 +60,7 @@ public async Task<int> UpdateAsync(TId id, dynamic data)
/// <returns></returns>
public
async
Task
<
bool
>
DeleteAsync
(
TId
id
)
{
return
(
await
database
.
ExecuteAsync
(
"delete from "
+
TableName
+
" where Id = @id"
,
new
{
id
}))
>
0
;
return
(
await
database
.
ExecuteAsync
(
"delete from "
+
TableName
+
" where Id = @id"
,
new
{
id
})
.
ConfigureAwait
(
false
)
)
>
0
;
}
/// <summary>
...
...
@@ -70,58 +70,58 @@ public async Task<bool> DeleteAsync(TId id)
/// <returns></returns>
public
async
Task
<
T
>
GetAsync
(
TId
id
)
{
return
(
await
database
.
QueryAsync
<
T
>(
"select * from "
+
TableName
+
" where Id = @id"
,
new
{
id
})).
FirstOrDefault
();
return
(
await
database
.
QueryAsync
<
T
>(
"select * from "
+
TableName
+
" where Id = @id"
,
new
{
id
})
.
ConfigureAwait
(
false
)
).
FirstOrDefault
();
}
public
virtual
async
Task
<
T
>
FirstAsync
()
{
return
(
await
database
.
QueryAsync
<
T
>(
"select top 1 * from "
+
TableName
)).
FirstOrDefault
();
return
(
await
database
.
QueryAsync
<
T
>(
"select top 1 * from "
+
TableName
)
.
ConfigureAwait
(
false
)
).
FirstOrDefault
();
}
public
async
Task
<
IEnumerable
<
T
>>
AllAsync
()
public
Task
<
IEnumerable
<
T
>>
AllAsync
()
{
return
await
database
.
QueryAsync
<
T
>(
"select * from "
+
TableName
);
return
database
.
QueryAsync
<
T
>(
"select * from "
+
TableName
);
}
}
public
async
Task
<
int
>
ExecuteAsync
(
string
sql
,
dynamic
param
=
null
)
public
Task
<
int
>
ExecuteAsync
(
string
sql
,
dynamic
param
=
null
)
{
return
await
connection
.
ExecuteAsync
(
sql
,
param
as
object
,
transaction
,
this
.
commandTimeout
);
return
connection
.
ExecuteAsync
(
sql
,
param
as
object
,
transaction
,
this
.
commandTimeout
);
}
public
async
Task
<
IEnumerable
<
T
>>
QueryAsync
<
T
>(
string
sql
,
dynamic
param
=
null
)
public
Task
<
IEnumerable
<
T
>>
QueryAsync
<
T
>(
string
sql
,
dynamic
param
=
null
)
{
return
await
connection
.
QueryAsync
<
T
>(
sql
,
param
as
object
,
transaction
,
commandTimeout
);
return
connection
.
QueryAsync
<
T
>(
sql
,
param
as
object
,
transaction
,
commandTimeout
);
}
public
async
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
public
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
{
return
await
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
return
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
}
public
async
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
public
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
{
return
await
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
return
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
}
public
async
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
public
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
{
return
await
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
return
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
}
public
async
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TFifth
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TFifth
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
public
Task
<
IEnumerable
<
TReturn
>>
QueryAsync
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TFifth
,
TReturn
>(
string
sql
,
Func
<
TFirst
,
TSecond
,
TThird
,
TFourth
,
TFifth
,
TReturn
>
map
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
bool
buffered
=
true
,
string
splitOn
=
"Id"
,
int
?
commandTimeout
=
null
)
{
return
await
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
return
connection
.
QueryAsync
(
sql
,
map
,
param
as
object
,
transaction
,
buffered
,
splitOn
);
}
public
async
Task
<
IEnumerable
<
dynamic
>>
QueryAsync
(
string
sql
,
dynamic
param
=
null
)
public
Task
<
IEnumerable
<
dynamic
>>
QueryAsync
(
string
sql
,
dynamic
param
=
null
)
{
return
await
connection
.
QueryAsync
(
sql
,
param
as
object
,
transaction
);
return
connection
.
QueryAsync
(
sql
,
param
as
object
,
transaction
);
}
public
async
Task
<
SqlMapper
.
GridReader
>
QueryMultipleAsync
(
string
sql
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
int
?
commandTimeout
=
null
,
CommandType
?
commandType
=
null
)
public
Task
<
SqlMapper
.
GridReader
>
QueryMultipleAsync
(
string
sql
,
dynamic
param
=
null
,
IDbTransaction
transaction
=
null
,
int
?
commandTimeout
=
null
,
CommandType
?
commandType
=
null
)
{
return
await
SqlMapper
.
QueryMultipleAsync
(
connection
,
sql
,
param
,
transaction
,
commandTimeout
,
commandType
);
return
SqlMapper
.
QueryMultipleAsync
(
connection
,
sql
,
param
,
transaction
,
commandTimeout
,
commandType
);
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录