KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm trying to use Dapper dot net in F# to perform a simple SQLite query. Dapper returns a collection of dynamic objects: using them in C# is straightforward, but from what I understood F# has no dynamic property lookup implementation out-of-the-box. This is working but I suppose there are better ways to do this without resorting to reflection: 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 the ? operator in this case?
Tags (comma-separated)
Save Edits
Cancel