Commit 2d01bfe7 authored by Anatoly Zhmur's avatar Anatoly Zhmur

Fixed issue with incorrect generated ParamReader then it has indexing properties declared.

parent 427e801d
......@@ -1453,7 +1453,7 @@ private static IEnumerable<PropertyInfo> FilterParameters(IEnumerable<PropertyIn
il.Emit(OpCodes.Ldarg_0); // stack is now [command]
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)
{
props = FilterParameters(props, identity.sql);
......
......@@ -1916,6 +1916,27 @@ public void TestWrongTypes_WithWrongTypes()
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
{
IDbConnection _conn;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment