StackExchange/dapper-dot-net — pull request #205 by BrannJoly (2014-11-20 12:38:17+00:00)
Title: fixed SO27024806

The main issue I'm trying to solve is that you can't use Dapper on f# records if they have some enum members stored as varchar in the database.

f# records have a single strongly typed constructor, and in the current master branch this strongly typed constructor is discarded by Dapper on the grounds that enum and string are not compatible types.

It's not so much an issue in c# because you can always define an appropriate constructors, but f# doesn't let you define any constructors.

I have added a unit test to describe the failing scenario (also described on stack overflow : SO27024806)

The change is a single-line changed in FindConstructor. I believe the performance impact is probably negligible. It's true we might end up with exceptions thrown if the value stored in the database can't be parsed as an enum, but that's consistent with how dapper handles enums stored in database as their base types.