After figuring out how to get the proxies to work in F# https://github.com/aspnet/EntityFrameworkCore/issues/12923, I tried to create queries using something like .Include(fun blog -> blog.Posts).ThenInclude(fun post -> post.Author), but post ends up being a collection. It fails in IntelliSense and during compilation. How do I make it work? Is there a workaround?
⚠Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.
@ctaggart We can look into this, but two things I can mention off the top of my head:
.Include("Posts.Author")I can confirm that the string version of Include is working in F#.
@manchoz's comment shows how to do it without hardcoding strings:
F# won't automatically upcast
List<T>toIEnumerable<T>. Explicitly upcasting the.Include()lambda toIEnumberable<T>seems to resolve the issue:
let q =
db.Schemas
.Include(fun sch -> sch.Entities :> IEnumerable<_>)
.ThenInclude(fun (ents : Entity) -> ents.Fields)
.ToList()
Most helpful comment
@ctaggart We can look into this, but two things I can mention off the top of my head:
.Include("Posts.Author")