Commit 69d5be37 authored by Sam Saffron's avatar Sam Saffron

inheritance was wonky, internal props on inherited stuff could not be set

parent 38b3f224
...@@ -1428,7 +1428,9 @@ static List<PropInfo> GetSettableProps(Type t) ...@@ -1428,7 +1428,9 @@ static List<PropInfo> GetSettableProps(Type t)
.Select(p => new PropInfo .Select(p => new PropInfo
{ {
Name = p.Name, Name = p.Name,
Setter = p.DeclaringType == t ? p.GetSetMethod(true) : p.DeclaringType.GetProperty(p.Name).GetSetMethod(true), Setter = p.DeclaringType == t ?
p.GetSetMethod(true) :
p.DeclaringType.GetProperty(p.Name, BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance).GetSetMethod(true),
Type = p.PropertyType Type = p.PropertyType
}) })
.Where(info => info.Setter != null) .Where(info => info.Setter != null)
......
...@@ -16,6 +16,35 @@ class Tests ...@@ -16,6 +16,35 @@ class Tests
{ {
SqlConnection connection = Program.GetOpenConnection(); SqlConnection connection = Program.GetOpenConnection();
public class AbstractInheritance
{
public abstract class Order
{
internal int Internal { get; set; }
protected int Protected { get; set; }
public int Public { get; set; }
public int ProtectedVal { get { return Protected; } }
}
public class ConcreteOrder : Order
{
public int Concrete { get; set; }
}
}
// http://stackoverflow.com/q/8593871
public void TestAbstractInheritance()
{
var order = connection.Query<AbstractInheritance.ConcreteOrder>("select 1 Internal,2 Protected,3 [Public],4 Concrete").First();
order.Internal.IsEqualTo(1);
order.ProtectedVal.IsEqualTo(2);
order.Public.IsEqualTo(3);
order.Concrete.IsEqualTo(4);
}
public void TestListOfAnsiStrings() public void TestListOfAnsiStrings()
{ {
......
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