Parametric LINQ query

后端 未结 1 1771
失恋的感觉
失恋的感觉 2020-12-19 10:48

This is another take on accessing dynamic objects in F# There I\'m using let y = x.Where(fun x -> x.City =\"London\").Select(\"new(City,Zip)\") to parametriz

相关标签:
1条回答
  • 2020-12-19 11:15

    Regarding quotation splicing, this works for me:

    open System.Linq
    
    type record = { x:int; y:string }
    
    let mkQuery q =
        query {
            for x in [{x=1;y="test"}].AsQueryable() do
            select ((%q) x)
        }
    
    mkQuery <@ fun r -> r.x, r.y @>
    |> Seq.iter (printfn "%A")
    
    0 讨论(0)
提交回复
热议问题