祝大家有美好的一天。
我有实体或复杂类型无法遇到这是我第一次遇到这种类型的错误有人帮助我
public IEnumerable<APPLICANT> GetApplicant()
{
IEnumerable<APPLICANT> applicantdata = Cache.Get("applicants") as IEnumerable<APPLICANT>;
IEnumerable<Profile> profiledata = Cache.Get("profiles") as IEnumerable<Profile>;
if (applicantdata == null)
{
var applicantList = (from a in context.Profiles
join app in context.APPLICANTs
on a.PROFILE_ID equals app.Profile_id
where app.APPLICANT_LogicalDelete == false
select new APPLICANT()
{
APPLICANT_LastName = a.Applicant_LASTNAME,
APPLICANT_FirstName = a.Applicant_FIRSTNAME,
APPLICANT_MiddleName = a.Applicant_MIDDLENAME,
APPLICANT_Address = a.Applicant_ADDRESS,
APPLICANT_City = a.Applicant_CITY,
APPLICANT_Phone = a.Applicant_PHONE,
APPLICANT_Email= a.Applicant_EMAIL
});
applicantdata = applicantList.Where(v => !String.IsNullOrEmpty(v.APPLICANT_LastName)).OrderBy(v => v.APPLICANT_ID).ToList();
if (applicantdata.Any())
{
Cache.Set("applicants", applicantdata, 30);
}
}
return applicantdata.ToList().Take(1000);
}
这是我遇到错误的行谢谢!
applicantdata = applicantList.Where(v => !String.IsNullOrEmpty(v.APPLICANT_LastName)).OrderBy(v => v.APPLICANT_ID).ToList();
上面一行的错误是
System.NotSupportedException:无法在 LINQ to Entities 查询中构造实体或复杂类型“Model.APPLICANT”。