dotnet / dotnet/efcore

Translate LINQ CountBy

Open
#32,741 1 comment 3 reactions 0 assignees View on GitHub
area-query customer-reported
Dominant language
C#
Stars
14.8k
Forks
3.4k
PR merge metrics
PR metrics pending

Description

.NET 9.0 will introduce [CountBy](https://github.com/dotnet/runtime/issues/77716), which we could translate.

CountBy can be rewritten as follows:

```cs
_ = blogs.CountBy(b => b.Id);
_ = blogs.GroupBy(b => b.Id).Select(g => KeyValuePair.Create(g.Key, g => g.Count()));
```

This feature could be part of the epic https://github.com/dotnet/efcore/issues/25570

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.