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
6e277406
Commit
6e277406
authored
Aug 31, 2018
by
David Glassborow
Committed by
Nick Craver
Sep 06, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make SqlMapper.Parse consistent with QueryImpl, closes #1111
parent
5189fcd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
SqlMapper.IDataReader.cs
Dapper/SqlMapper.IDataReader.cs
+12
-2
No files found.
Dapper/SqlMapper.IDataReader.cs
View file @
6e277406
...
@@ -15,10 +15,20 @@ public static IEnumerable<T> Parse<T>(this IDataReader reader)
...
@@ -15,10 +15,20 @@ public static IEnumerable<T> Parse<T>(this IDataReader reader)
{
{
if
(
reader
.
Read
())
if
(
reader
.
Read
())
{
{
var
deser
=
GetDeserializer
(
typeof
(
T
),
reader
,
0
,
-
1
,
false
);
var
effectiveType
=
typeof
(
T
);
var
deser
=
GetDeserializer
(
effectiveType
,
reader
,
0
,
-
1
,
false
);
var
convertToType
=
Nullable
.
GetUnderlyingType
(
effectiveType
)
??
effectiveType
;
do
do
{
{
yield
return
(
T
)
deser
(
reader
);
object
val
=
deser
(
reader
);
if
(
val
==
null
||
val
is
T
)
{
yield
return
(
T
)
val
;
}
else
{
yield
return
(
T
)
Convert
.
ChangeType
(
val
,
convertToType
,
System
.
Globalization
.
CultureInfo
.
InvariantCulture
);
}
}
while
(
reader
.
Read
());
}
while
(
reader
.
Read
());
}
}
}
}
...
...
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