Dapper dot net query in F#

This thread consists of several solutions for your problem. Especially, FSharp.Interop.Dynamic is available on NuGet and ready to use.


When using Dapper with F#, you can specify your query parameters using F# Anonymous Records and map the results directly to an F# Record, like so:

[<CLIMutable>]
type CustomerDto = 
    {
        FirstName: string
    }

let selectSql = "select first_name as FirstName from customers where first_name = @firstName"

conn.Query<CustomerDto>(selectSql, {|firstName = "Francesco"|})

Note that F# Anonymous Records were introduced in F# 4.6.

Tags:

F#

Dapper