-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Sum or Count of inner navigation property on GroupBy not being translated #24869
Comments
Duplicate of #22609 |
@smitpatel is there any workaround to solve this? |
Current work-around is to expand navigations beforehand. You should be able to do so by constructing anonymous type which includes all the navigations in element selector of the query2 = query.GroupBy(x => new {x.Ticket.Company.Id, x.Ticket.Company.BusinessName},
x => new { x, x.SupportOption}).Select(x => new TicketStatisticsRow {
Key = x.Key.Id + x.Key.BusinessName,
OperationNumber = x.Count(),
TotalMinutes = x.Sum(el => el.x.Minutes),
TotalHours = x.Sum(el => el.x.Minutes) / (decimal) 60,
TotalCallOutCharges = x.Sum(el => el.SupportOption.HasCallOutCharge ? 1 : 0)
}); |
@smitpatel This and other common query workarounds should be documented if the feature is not implemented in 6.0.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sum or Count of inner navigation property on GroupBy not working
Include your code
Support Option is the navigation property which contains HasCallOutCharge property which is a boolean and it's what I'm trying to count.
###Message error
###Stack trace
Include provider and version information
EF Core version: 5.0.5
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework:. NET 5.0
Operating system: Windows10
IDE: Visual Studio 2019 16.9.4
The text was updated successfully, but these errors were encountered: