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
c03040da
Commit
c03040da
authored
Sep 15, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't init outputCallbacks unless there are callbacks
parent
d1e6d6f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+11
-5
Tests.cs
Tests/Tests.cs
+0
-1
No files found.
Dapper NET40/SqlMapper.cs
View file @
c03040da
...
...
@@ -4277,14 +4277,20 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
}
// Now that the parameters are added to the command, let's place our output callbacks
foreach
(
var
generator
in
this
.
outputCallbacks
)
var
tmp
=
outputCallbacks
;
if
(
tmp
!=
null
)
{
generator
();
foreach
(
var
generator
in
tmp
)
{
generator
();
}
}
}
foreach
(
var
param
in
parameters
.
Values
.
Where
(
p
=>
!
p
.
CameFromTemplate
)
)
foreach
(
var
param
in
parameters
.
Values
)
{
if
(
param
.
CameFromTemplate
)
continue
;
var
dbType
=
param
.
DbType
;
var
val
=
param
.
Value
;
string
name
=
Clean
(
param
.
Name
);
...
...
@@ -4525,7 +4531,7 @@ public DynamicParameters Output<T>(T target, Expression<Func<T, object>> express
// Queue the preparation to be fired off when adding parameters to the DbCommand
MAKECALLBACK
:
this
.
outputCallbacks
.
Add
(()
=>
(
outputCallbacks
??
(
outputCallbacks
=
new
List
<
Action
>()))
.
Add
(()
=>
{
// Finally, prep the parameter and attach the callback to it
ParamInfo
parameter
;
...
...
@@ -4559,7 +4565,7 @@ public DynamicParameters Output<T>(T target, Expression<Func<T, object>> express
return
this
;
}
private
readonly
List
<
Action
>
outputCallbacks
=
new
List
<
Action
>()
;
private
List
<
Action
>
outputCallbacks
;
private
readonly
Dictionary
<
string
,
Action
<
object
,
DynamicParameters
>>
cachedOutputSetters
=
new
Dictionary
<
string
,
Action
<
object
,
DynamicParameters
>>();
...
...
Tests/Tests.cs
View file @
c03040da
...
...
@@ -1176,7 +1176,6 @@ public void TestSupportForDynamicParameters()
p
.
Get
<
int
>(
"age"
).
IsEqualTo
(
11
);
}
[
ActiveTest
]
public
void
TestSupportForDynamicParametersOutputExpressions
()
{
var
bob
=
new
Person
{
Name
=
"bob"
,
PersonId
=
1
,
Address
=
new
Address
{
PersonId
=
2
}
};
...
...
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