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
5e4b2726
Commit
5e4b2726
authored
Feb 26, 2016
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:StackExchange/dapper-dot-net
parents
bebe80bc
d2d1adff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
5 deletions
+9
-5
SqlMapper.cs
Dapper/SqlMapper.cs
+9
-5
No files found.
Dapper/SqlMapper.cs
View file @
5e4b2726
...
...
@@ -2295,7 +2295,7 @@ internal static IList<LiteralToken> GetLiteralTokens(string sql)
il
.
Emit
(
OpCodes
.
Dup
);
// stack is now [parameters] [[parameters]] [parameter] [parameter]
il
.
Emit
(
OpCodes
.
Ldloc_0
);
// stack is now [parameters] [[parameters]] [parameter] [parameter] [typed-param]
il
.
Emit
(
callOpCode
,
prop
.
GetGetMethod
());
// stack is [parameters] [[parameters]] [parameter] [parameter] [typed-value]
bool
checkForNull
=
true
;
bool
checkForNull
;
if
(
prop
.
PropertyType
.
IsValueType
())
{
var
propType
=
prop
.
PropertyType
;
...
...
@@ -2308,10 +2308,11 @@ internal static IList<LiteralToken> GetLiteralTokens(string sql)
{
// Nullable<SomeEnum>; we want to box as the underlying type; that's just *hard*; for
// simplicity, box as Nullable<SomeEnum> and call SanitizeParameterValue
callSanitize
=
true
;
callSanitize
=
checkForNull
=
true
;
}
else
{
checkForNull
=
false
;
// non-nullable enum; we can do that! just box to the wrong type! (no, really)
switch
(
TypeExtensions
.
GetTypeCode
(
Enum
.
GetUnderlyingType
(
propType
)))
{
...
...
@@ -2326,9 +2327,9 @@ internal static IList<LiteralToken> GetLiteralTokens(string sql)
}
}
}
else
if
(
nullType
==
null
)
{
// struct but not Nullable<T>; boxed value cannot be null
checkForNull
=
false
;
else
{
checkForNull
=
nullType
!=
null
;
}
il
.
Emit
(
OpCodes
.
Box
,
propType
);
// stack is [parameters] [[parameters]] [parameter] [parameter] [boxed-value]
if
(
callSanitize
)
...
...
@@ -2337,6 +2338,9 @@ internal static IList<LiteralToken> GetLiteralTokens(string sql)
il
.
EmitCall
(
OpCodes
.
Call
,
typeof
(
SqlMapper
).
GetMethod
(
nameof
(
SanitizeParameterValue
)),
null
);
// stack is [parameters] [[parameters]] [parameter] [parameter] [boxed-value]
}
}
else
{
checkForNull
=
true
;
// if not a value-type, need to check
}
if
(
checkForNull
)
{
...
...
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