Quantcast
Viewing latest article 15
Browse Latest Browse All 38

Answer by Tarmil for F# query expression nested lists

What you're doing is pretty much exactly what groupJoin does.

let events =    query {        for event in db.Events do        groupJoin ea in db.EventAttendances on (event.Id = ea.EventId) into result        select (event, query { for ea in result do                               select { FirstName = ea.Member.FirstName                                        LastName = ea.Member.LastName                                        IsAttending = ea.IsAttending } })    }    |> Seq.map (fun (e, attendees) ->         { Id = e.Id           Description = e.Description           DateTime = e.DateTime           Attendees = attendees |> Seq.toList })    |> Seq.toList

Viewing latest article 15
Browse Latest Browse All 38

Trending Articles