Based on some code I am working with this appears to be the case. I couldn't find anything in the dapper documentation that explicitly said that it won't work with members that have custom get/set logic, but I did see this example:
public class Dog
{
public int? Age { get; set; }
public Guid Id { get; set; }
public string Name { get; set; }
public float? Weight { get; set; }
public int IgnoredProperty { get { return 1; } } //red flag?
}
It seems like the fact that the one member that has custom get behavior is prefixed with Ignored
might suggest that Dapper will not try to populate these values. Is this true? Is this in the documentation and I just overlooked it?
The reason dapper will ignore that one is that it doesn't have a setter. It doesn't care how your properties are implemented internally, but it needs a setter to use a property (although the setter doesn't have to be public).
It can also use fields, as an aside.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With