-
Notifications
You must be signed in to change notification settings - Fork 789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Query builder with EF core can't return fsharp tuples (and sometimes new objects) using async methods #3782
Comments
Notes
|
There is another lingering bug in the treatment of tuples in I assume using an intermediate record type will work. |
There are two bugs here
|
@Lanayx could you please provide an example when the order matters? It'll be useful. |
The example is already in the main post right above |
The problem happens with anonymous records too, task {
let db = app.Services.GetRequiredService<AppDbContext>()
let query1 = // EntityQueryable<<>f__AnonymousType1003022151<string, string>>
db.Blogs.Select(fun x -> {| Path = x.Slug; Title = x.Name |})
let query2 = // System.Linq.Enumerable+SelectEnumerableIterator`2[Microsoft.FSharp.Linq.RuntimeHelpers.AnonymousObject`2[System.String,System.String],<>f__AnonymousType1003022151`2[System.String,System.String]]
query {
for x in db.Blogs do
select {| Path = x.Slug; Title = x.Name |}
}
let! result1 = query1.ToArrayAsync() // works
let! result2 = query2.ToArrayAsync() // throws
return printfn $"%A{result1} | %A{result2}"
} |
Any progress on this? |
There is also #15648 which impacts the usage of query builder on EF |
I'm getting an exсeption when using this code
If I choose
select p
orselect p.Id
insead ofselect (p.Id, p.Name)
, this works fine. If I writeToList
instead ofToListAsync
this works fine as well. C# version with Tuples works well. With provided F# code it fails with this exception:Also noticed that
select { Id = p.Id; Name = p.Name }
works, whileselect { Name = p.Name; Id = p.Id }
doesn't and fails with exception:The text was updated successfully, but these errors were encountered: