Hi PolachanPaily-2805,
First, client side GroupBy is not supported in .netcore 3.1.
You need to grab the data first and processed later with this LINQ query.
So you can change your query as below:
var t=goContext.goDepartmentWorkTime.Include(x=>x.Depot).Include(x=>x.Department).ToList().GroupBy(d => new { d.DepotNo, d.Depot.DepotName })
.Select(g => new
{
id = g.Key.DepotNo,
title = g.Key.DepotName,
subs = g.Select(dd => new
{
id = dd.DepotNo + "." + dd.DepartmentID,
title = dd.Depot.DepotNo + "." + dd.Department.DepartmentName
}).ToList()
}).ToList();
You can also try to use AsEnumerable(), more details please refer to this thread.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.