我有一个linq查询来获取测试数量的计数。我正在使用分组和计数,但出现错误
var response = from st in students
join c in classes on st.id equals c.studentid
join sd in subjectDetails on sd.classId equals c.id && sd.studentid equals c.studentid
group st.id,st.Name,c.Class,sd.Tests into res
select new StudentResponse
{
StudentName = res.key.Name,StudentClass = res.key.Class
StudentGrades = new List<StudentGrades>
{
NumberOfTests = res.Count(x => x.Tests != ""),// I am getting an error here
Subject = res.Key.OperationName,TotalMarks = res.Sum(x => x.ItemsCount)
}
}).ToListAsync();
错误:
无法翻译,将在本地进行评估。”。通过将事件ID'RelationalEventId.QueryClientEvaluationWarning'传递到'DbContext.Onconfiguring
中的'ConfigureWarnings'方法,可以抑制或记录此异常。
如何获取分组依据的测试数?