dotnet / dotnet/efcore

Expand navigations on grouping key

Open
#29,014 3 comments 3 reactions 0 assignees View on GitHub
area-groupby area-query
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

Enabling group by entity type allows navigations to be written on the grouping key.
e.g.
```C#
context.Customers.GroupBy(c => c.Navigation).Select(g => g.Key.Navigation2)
```

These navigations on grouping key cannot be expanded/translated in normal way because normal path will try to add Join after GroupBy, which doesn't translate to SQL. If we add join before GroupBy then it still won't be available in selector after grouping. All navigations on grouping key required to be created using subquery form using correlation predicate (and SingleOrDefault if reference navigation)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.