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
2d01bfe7
Commit
2d01bfe7
authored
Sep 18, 2012
by
Anatoly Zhmur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed issue with incorrect generated ParamReader then it has indexing properties declared.
parent
427e801d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletion
+22
-1
SqlMapper.cs
Dapper/SqlMapper.cs
+1
-1
Tests.cs
Tests/Tests.cs
+21
-0
No files found.
Dapper/SqlMapper.cs
View file @
2d01bfe7
...
@@ -1453,7 +1453,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
...
@@ -1453,7 +1453,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is now [command]
il
.
Emit
(
OpCodes
.
Ldarg_0
);
// stack is now [command]
il
.
EmitCall
(
OpCodes
.
Callvirt
,
typeof
(
IDbCommand
).
GetProperty
(
"Parameters"
).
GetGetMethod
(),
null
);
// stack is now [parameters]
il
.
EmitCall
(
OpCodes
.
Callvirt
,
typeof
(
IDbCommand
).
GetProperty
(
"Parameters"
).
GetGetMethod
(),
null
);
// stack is now [parameters]
IEnumerable
<
PropertyInfo
>
props
=
type
.
GetProperties
().
OrderBy
(
p
=>
p
.
Name
);
IEnumerable
<
PropertyInfo
>
props
=
type
.
GetProperties
().
Where
(
p
=>
p
.
GetIndexParameters
().
Length
==
0
).
OrderBy
(
p
=>
p
.
Name
);
if
(
filterParams
)
if
(
filterParams
)
{
{
props
=
FilterParameters
(
props
,
identity
.
sql
);
props
=
FilterParameters
(
props
,
identity
.
sql
);
...
...
Tests/Tests.cs
View file @
2d01bfe7
...
@@ -1916,6 +1916,27 @@ public void TestWrongTypes_WithWrongTypes()
...
@@ -1916,6 +1916,27 @@ public void TestWrongTypes_WithWrongTypes()
item
.
D
.
Equals
(
true
);
item
.
D
.
Equals
(
true
);
}
}
public
class
ParameterWithIndexer
{
public
int
A
{
get
;
set
;
}
public
virtual
string
this
[
string
columnName
]
{
get
{
return
null
;
}
set
{
}
}
}
public
void
TestParameterWithIndexer
()
{
connection
.
Execute
(
@"create proc #TestProcWithIndexer
@A int
as
begin
select @A
end"
);
var
item
=
connection
.
Query
<
int
>(
"#TestProcWithIndexer"
,
new
ParameterWithIndexer
(),
commandType
:
CommandType
.
StoredProcedure
).
Single
();
}
class
TransactedConnection
:
IDbConnection
class
TransactedConnection
:
IDbConnection
{
{
IDbConnection
_conn
;
IDbConnection
_conn
;
...
...
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