question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add EntityFrameworkQueryableExtensions.ToLookupAsync

See original GitHub issue

We already have ToDictionaryAsync, however when loading associations often what you want is a lookup which you would otherwise have to construct using two separate statements:

var childLookup = await context.ChildEntities
.Where(c => Enumerable.Contains(parentIds, c.ParentId))
.ToLookupAsync(c => c.ParentId);

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:2
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ajcvickerscommented, Feb 18, 2022

@jcracknell You are correct. I’ll bring it up again with the team.

0reactions
ajcvickerscommented, Mar 15, 2022

Discussed with the team and we still feel this is better done without the additional copy.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Implement ToLookupAsync · Issue #15916 · dotnet/efcore
We decided not to fix this since the implementation was converting queryable to enumerable and calling API on top of it (implementation was ......
Read more >
EntityFrameworkQueryableExten...
Asynchronously creates a List<T> from an IQueryable<T> by enumerating it asynchronously.
Read more >
EntityFrameworkQueryableExten...
Asynchronously computes the sum of the sequence of values that is obtained by invoking a projection function on each element of the input...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found