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
1df754e3
Commit
1df754e3
authored
May 03, 2011
by
Sam Saffron
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reduce lines of code
parent
aacfdf25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
14 deletions
+3
-14
SqlMapper.cs
Dapper/SqlMapper.cs
+3
-14
No files found.
Dapper/SqlMapper.cs
View file @
1df754e3
...
...
@@ -404,35 +404,24 @@ private static CacheInfo GetCacheInfo(object param, Identity identity)
private
static
object
GetDynamicDeserializer
(
IDataRecord
reader
,
int
startBound
=
0
,
int
length
=
-
1
,
bool
returnNullIfFirstMissing
=
false
)
{
var
colNames
=
new
List
<
string
>();
if
(
length
==
-
1
)
{
length
=
reader
.
FieldCount
-
startBound
;
}
for
(
var
i
=
startBound
;
i
<
startBound
+
length
;
i
++)
{
colNames
.
Add
(
reader
.
GetName
(
i
));
}
Func
<
IDataReader
,
ExpandoObject
>
rval
=
r
=>
{
IDictionary
<
string
,
object
>
row
=
new
ExpandoObject
();
var
i
=
startBound
;
var
first
=
true
;
foreach
(
var
colName
in
colNames
)
for
(
var
i
=
startBound
;
i
<
startBound
+
length
;
i
++)
{
var
tmp
=
r
.
GetValue
(
i
);
tmp
=
tmp
==
DBNull
.
Value
?
null
:
tmp
;
row
[
colName
]
=
tmp
;
if
(
returnNullIfFirstMissing
&&
first
&&
tmp
==
null
)
row
[
r
.
GetName
(
i
)
]
=
tmp
;
if
(
returnNullIfFirstMissing
&&
i
==
startBound
&&
tmp
==
null
)
{
return
null
;
}
i
++;
first
=
false
;
}
return
(
ExpandoObject
)
row
;
};
...
...
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