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
dc1d0270
Commit
dc1d0270
authored
Oct 16, 2012
by
Marc Gravell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a different constant for list parameters
parent
f22447df
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
SqlMapper.cs
Dapper/SqlMapper.cs
+6
-5
No files found.
Dapper/SqlMapper.cs
View file @
dc1d0270
...
...
@@ -427,14 +427,14 @@ internal static DbType LookupDbType(Type type, string name)
}
if
(
typeof
(
IEnumerable
).
IsAssignableFrom
(
type
))
{
// use xml to denote its a list, hacky but will work on any DB
return
DbType
.
Xml
;
return
DynamicParameters
.
EnumerableMultiParameter
;
}
throw
new
NotSupportedException
(
string
.
Format
(
"The member {0} of type {1} cannot be used as a parameter value"
,
name
,
type
));
}
/// <summary>
/// Identity of a cached query in Dapper, used for extensability
/// </summary>
...
...
@@ -1541,7 +1541,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
continue
;
}
DbType
dbType
=
LookupDbType
(
prop
.
PropertyType
,
prop
.
Name
);
if
(
dbType
==
D
bType
.
Xml
)
if
(
dbType
==
D
ynamicParameters
.
EnumerableMultiParameter
)
{
// this actually represents special handling for list types;
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is now [parameters] [command]
...
...
@@ -2458,6 +2458,7 @@ public void Dispose()
/// </summary>
partial
class
DynamicParameters
:
SqlMapper
.
IDynamicParameters
{
internal
const
DbType
EnumerableMultiParameter
=
(
DbType
)(-
1
);
static
Dictionary
<
SqlMapper
.
Identity
,
Action
<
IDbCommand
,
object
>>
paramReaderCache
=
new
Dictionary
<
SqlMapper
.
Identity
,
Action
<
IDbCommand
,
object
>>();
Dictionary
<
string
,
ParamInfo
>
parameters
=
new
Dictionary
<
string
,
ParamInfo
>();
...
...
@@ -2620,8 +2621,8 @@ protected void AddParameters(IDbCommand command, SqlMapper.Identity identity)
if
(
dbType
==
null
&&
val
!=
null
)
dbType
=
SqlMapper
.
LookupDbType
(
val
.
GetType
(),
name
);
if
(
dbType
==
D
bType
.
Xml
)
{
// actually represents "in" lists
if
(
dbType
==
D
ynamicParameters
.
EnumerableMultiParameter
)
{
#pragma warning disable 612, 618
SqlMapper
.
PackListParameters
(
command
,
name
,
val
);
#pragma warning restore 612, 618
...
...
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