Skip to content
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

How do you do .ThenInclude from F#? #903

Closed
ctaggart opened this issue Aug 8, 2018 — with docs.microsoft.com · 3 comments
Closed

How do you do .ThenInclude from F#? #903

ctaggart opened this issue Aug 8, 2018 — with docs.microsoft.com · 3 comments
Labels
closed-question help wanted This issue involves technologies where we are not experts. Expert help would be appreciated.

Comments

Copy link

ctaggart commented Aug 8, 2018

After figuring out how to get the proxies to work in F# dotnet/efcore#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?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@ajcvickers
Copy link
Contributor

@ctaggart We can look into this, but two things I can mention off the top of my head:

@divega divega added the help wanted This issue involves technologies where we are not experts. Expert help would be appreciated. label Feb 21, 2019
@Ryan-Palmer
Copy link

I can confirm that the string version of Include is working in F#.

@dharmaturtle
Copy link

@manchoz's comment shows how to do it without hardcoding strings:

F# won't automatically upcast List<T> to IEnumerable<T>. Explicitly upcasting the .Include() lambda to IEnumberable<T> seems to resolve the issue:

let q =
    db.Schemas
       .Include(fun sch -> sch.Entities :> IEnumerable<_>)
           .ThenInclude(fun (ents : Entity) -> ents.Fields)
       .ToList()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-question help wanted This issue involves technologies where we are not experts. Expert help would be appreciated.
Projects
None yet
Development

No branches or pull requests

5 participants