Dzoukr/Dapper.FSharp

Does Dapper.FSharp support records when using QueryAsync?

Jmaharman opened this issue · 6 comments

This is mostly a clarification post, rather than requesting any functionality.

On the readme it says this supports "Support for F# records / anonymous records", but I'm not sure if that is limited to the CE builder stuff, or if it includes QueryAsync.

When I use connection.QueryAsync(mySqlText, myParams) I can get anonymous records to work no problem, but an F# record gives me the no parameterless constructor found.

Is this expected, or have I messed something up?

Thanks for the great library, and your time reading this post.

I get that error "ALOT" using FSharp records, but it is very likely that you have either a datatype or field name mismatch.
Just check your schema again. :) Good luck!

Also check that you have registered any "Option" types - if you have options in your record.

Thanks @TerenceHinrichsen, I'll make sure I do that!

Thanks, @TerenceHinrichsen, for clarification. I don't see any other steps to take - make sure your columns are 1:1 with anonymous records + properties are named same as in DB table.

Sorry, just hit wrong button 😄 (oh, mornings...)

ah I've got it, it was the order of the parameters in the constructor. Interesting this wasn't a problem for the anonymous record.

Has anyone got any recommendations when using records and Dapper's QueryAsync and my own SQL? I'm a bit worried of the flakeyness of it if someone changes the ordering of a property / SQL statement.