Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Dapper
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tsai
Dapper
Commits
c287693c
Commit
c287693c
authored
Oct 09, 2015
by
Nick Craver
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #338 from phnx47/master
fix Cast at QueryAsync<T>
parents
b77e5384
2ead2428
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
1 deletion
+13
-1
SqlMapperAsync.cs
Dapper NET45/SqlMapperAsync.cs
+13
-1
No files found.
Dapper NET45/SqlMapperAsync.cs
View file @
c287693c
...
...
@@ -4,6 +4,7 @@
using
System.Collections.Generic
;
using
System.Data
;
using
System.Data.Common
;
using
System.Globalization
;
using
System.Linq
;
using
System.Threading
;
using
System.Threading.Tasks
;
...
...
@@ -107,9 +108,20 @@ private static async Task<IEnumerable<T>> QueryAsync<T>(this IDbConnection cnn,
if
(
command
.
Buffered
)
{
List
<
T
>
buffer
=
new
List
<
T
>();
var
convertToType
=
Nullable
.
GetUnderlyingType
(
effectiveType
)
??
effectiveType
;
while
(
await
reader
.
ReadAsync
(
cancel
).
ConfigureAwait
(
false
))
{
buffer
.
Add
((
T
)
func
(
reader
));
object
val
=
func
(
reader
);
if
(
val
==
null
||
val
is
T
)
{
buffer
.
Add
((
T
)
val
);
}
else
{
buffer
.
Add
((
T
)
Convert
.
ChangeType
(
val
,
convertToType
,
CultureInfo
.
InvariantCulture
));
}
}
while
(
await
reader
.
NextResultAsync
().
ConfigureAwait
(
false
))
{
}
command
.
OnCompleted
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment