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
36fdd579
Commit
36fdd579
authored
Jul 01, 2014
by
Marc Gravell
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #126 from davidomeara/master
AmbiguousMatchException with multiple indexers
parents
a8043e02
53a38787
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
SqlMapper.cs
Dapper NET40/SqlMapper.cs
+7
-1
Tests.cs
Tests/Tests.cs
+20
-0
No files found.
Dapper NET40/SqlMapper.cs
View file @
36fdd579
...
...
@@ -4241,7 +4241,13 @@ internal static MethodInfo GetPropertySetter(PropertyInfo propertyInfo, Type typ
{
return
propertyInfo
.
DeclaringType
==
type
?
propertyInfo
.
GetSetMethod
(
true
)
:
propertyInfo
.
DeclaringType
.
GetProperty
(
propertyInfo
.
Name
,
BindingFlags
.
Public
|
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
).
GetSetMethod
(
true
);
propertyInfo
.
DeclaringType
.
GetProperty
(
propertyInfo
.
Name
,
BindingFlags
.
Public
|
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
,
Type
.
DefaultBinder
,
propertyInfo
.
PropertyType
,
propertyInfo
.
GetIndexParameters
().
Select
(
p
=>
p
.
ParameterType
).
ToArray
(),
null
).
GetSetMethod
(
true
);
}
internal
static
List
<
PropertyInfo
>
GetSettableProps
(
Type
t
)
...
...
Tests/Tests.cs
View file @
36fdd579
...
...
@@ -2290,6 +2290,26 @@ select @A
var
item
=
connection
.
Query
<
int
>(
"#TestProcWithIndexer"
,
new
ParameterWithIndexer
(),
commandType
:
CommandType
.
StoredProcedure
).
Single
();
}
public
class
MultipleParametersWithIndexerDeclaringType
{
public
object
this
[
object
field
]
{
get
{
return
null
;
}
set
{
}
}
public
object
this
[
object
field
,
int
index
]
{
get
{
return
null
;
}
set
{
}
}
public
int
B
{
get
;
set
;
}
}
public
class
MultipleParametersWithIndexer
:
MultipleParametersWithIndexerDeclaringType
{
public
int
A
{
get
;
set
;
}
}
public
void
TestMultipleParametersWithIndexer
()
{
var
order
=
connection
.
Query
<
MultipleParametersWithIndexer
>(
"select 1 A,2 B"
).
First
();
order
.
A
.
IsEqualTo
(
1
);
order
.
B
.
IsEqualTo
(
2
);
}
public
void
Issue_40_AutomaticBoolConversion
()
{
var
user
=
connection
.
Query
<
Issue40_User
>(
"select UserId=1,Email='abc',Password='changeme',Active=cast(1 as tinyint)"
).
Single
();
...
...
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