Merge pull request #51 from azhmur/master

Fixed issue with incorrect generated ParamReader when it has indexing properties declared.
This commit is contained in:
Marc Gravell
2012-09-18 22:35:10 -07:00
2 changed files with 22 additions and 1 deletions
+1 -1
View File
@@ -1453,7 +1453,7 @@ this IDbConnection cnn, string sql, Func<TFirst, TSecond, TThird, TFourth, TRetu
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);
+21
View File
@@ -1916,6 +1916,27 @@ Order by p.Id";
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;