Trying to get a query with an anonymous type working:
let temporaryBookModel =
query <@ context.Books
|> Seq.filter (fun book -> book.Id = bookId)
|> Seq.map(fun item -> (item.Id, item.ParentUser.Id, item.ParentUser.Alias, item.Tagline, item.Title, item.Visible, item.CreatedDate))
|> Seq.head @>
And I keep getting:
{"Only parameterless constructors and initializers are supported in LINQ to Entities."}
Which would make sense if I were mapping the values to a type directly, but anonymous types shouldn't throw this exception I would think since they are based on the object initializer functionality? Unfortunately anything I found on anonymous types seem to say this is the correct syntax. That or something like this:
let temporaryBookModel =
query <@ context.Books
|> Seq.filter (fun book -> book.Id = bookId)
|> Seq.map(fun item -> (("a", item.Id), ("b", item.ParentUser.Id), ("c", item.ParentUser.Alias), ("d", item.Tagline), ("e", item.Title, item.Visible), ("f", item.CreatedDate)))
|> Seq.head @>