我遇到了一个错误(EntityFramework.dll中发生了'System.InvalidOperationException'类型的异常,但未在用户代码中处理)。我的查询如下所示。请给我一些指示。
return (from r in mcontext.BursaryMasters
join s in mcontext.AcedemicYears on r.AcademicId equals s.AcademicYearID
where s.AcademicYearDesc == academicYear && r.LevelID == level
orderby order1 ascending
select new Result()
{
StudentID = r.StudentID,
Name = r.Name,
Distance = r.Distance,
AnnualIncome = r.AnnualIncome
}).ToList();
答案 0 :(得分:0)
我认为问题出在你的orderby命令中。 order1
看起来像一个CLR对象,是吗?然后它无法转换为SQL。您可能希望将其替换为r
或s
的某些属性,例如s.SomeAttribute
。