Dapper
Dapper copied to clipboard
ApplyNullValues behaviour with nullable types/nullable reference types
There have been a couple of issues around nullable reference types 1 2.
I was wondering what people think about the behavior of the ApplyNullValues setting in the context of nullable types (both nullable value types and reference types). I think it should throw an exception when a null value is read from the DB but the target is not nullable. In the case of nullable reference types this is definitely an issue because it would make fields that aren't supposed to be null null. For value types they would just be 0/default. Less bad, but still wrong in my opinion.