Dapper dot net query in F #

I am trying to use Dapper dot net in F # to execute a simple SQLite query. Dapper returns a collection of dynamic objects: using them in C # is simple, but from what I understood, F # does not have a dynamic implementation of finding properties out of the box.

This works, but I believe that there are better ways to do this without thinking:

let (?) x prop = let flags = BindingFlags.GetProperty ||| BindingFlags.InvokeMethod x.GetType().InvokeMember(prop, flags, null, x, [||]) let doQuery () = //... let conn = new SQLiteConnection (connString) conn.Open () conn.Query("select first_name from customers") |> Seq.map (fun c -> c ? first_name) |> List.ofSeq 

What is the best way to implement it? operator in this case?

+7
source share
1 answer

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

+6
source

All Articles