Commit 9492f3f6 authored by Sam Saffron's avatar Sam Saffron

Extra properties were causing a crash

parent f7b9d73e
...@@ -128,8 +128,6 @@ public bool Equals(Identity other) ...@@ -128,8 +128,6 @@ public bool Equals(Identity other)
} }
} }
/// <summary> /// <summary>
/// Execute parameterized SQL /// Execute parameterized SQL
/// </summary> /// </summary>
...@@ -421,7 +419,7 @@ private static object GetStructDeserializer<T>(IDataReader reader) ...@@ -421,7 +419,7 @@ private static object GetStructDeserializer<T>(IDataReader reader)
Label finishLabel = il.DefineLabel(); Label finishLabel = il.DefineLabel();
il.Emit(OpCodes.Ldarg_0); // stack is now [target][target][reader] il.Emit(OpCodes.Ldarg_0); // stack is now [target][target][reader]
EmitInt32(il, index++); // stack is now [target][target][reader][index] EmitInt32(il, index); // stack is now [target][target][reader][index]
il.Emit(OpCodes.Callvirt, getItem); // stack is now [target][target][value-as-object] il.Emit(OpCodes.Callvirt, getItem); // stack is now [target][target][value-as-object]
...@@ -440,6 +438,7 @@ private static object GetStructDeserializer<T>(IDataReader reader) ...@@ -440,6 +438,7 @@ private static object GetStructDeserializer<T>(IDataReader reader)
il.MarkLabel(finishLabel); il.MarkLabel(finishLabel);
} }
index += 1;
} }
il.Emit(OpCodes.Ret); // stack is empty il.Emit(OpCodes.Ret); // stack is empty
......
...@@ -89,6 +89,22 @@ public class Dog ...@@ -89,6 +89,22 @@ public class Dog
public int IgnoredProperty { get { return 1; } } public int IgnoredProperty { get { return 1; } }
} }
public void TestExtraFields()
{
var guid = Guid.NewGuid();
var dog = connection.ExecuteMapperQuery<Dog>("select '' as Extra, 1 as Age, 0.1 as Name1 , Id = @id", new { Id = guid});
dog.Count()
.IsEqualTo(1);
dog.First().Age
.IsEqualTo(1);
dog.First().Id
.IsEqualTo(guid);
}
public void TestStrongType() public void TestStrongType()
{ {
var guid = Guid.NewGuid(); var guid = Guid.NewGuid();
...@@ -104,6 +120,7 @@ public void TestStrongType() ...@@ -104,6 +120,7 @@ public void TestStrongType()
.IsEqualTo(guid); .IsEqualTo(guid);
} }
public void TestExpando() public void TestExpando()
{ {
var rows = connection.ExecuteMapperQuery("select 1 A, 2 B union all select 3, 4"); var rows = connection.ExecuteMapperQuery("select 1 A, 2 B union all select 3, 4");
......
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