我希望有人可以帮助我,因为当我编辑我的代码时。异常显示
这是我的控制器
public IEnumerable<APPLICANT> GetApplicant()
{
IEnumerable<APPLICANT> applicantdata = Cache.Get("applicants") as IEnumerable<APPLICANT>;
if (applicantdata == null)
{
var data = from app in context.APPLICANTs
join a in context.Profiles
on app.Profile_id equals a.PROFILE_ID into output
from j in output.DefaultIfEmpty()
select new {
Id = app.APPLICANT_ID,
LastName =
(j == null ? app.APPLICANT_LastName : j.Applicant_LASTNAME)
};
var applicant = data
.Where(v => !String.IsNullOrEmpty(v.LastName))
.Take(1000);
applicantdata = (from a in applicant
select new APPLICANT() {
APPLICANT_ID = a.Id,
APPLICANT_LastName = a.LastName
}).AsEnumerable();
if (applicantdata.Any())
{
Cache.Set("applicants", applicantdata, 30);
}
}
return applicantdata;
}
这是一个例外:
NotSupportedException 未被用户代码处理。实体或复杂类型“ ”未在 LINQ to Entities 查询中构造。LINQ ASP.NET
在这一行:
if (applicantdata.Any())