现在我正在尝试右加入一个异常弹出。
这是我的控制器
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 into joined
from j in joined.DefaultIfEmpty()
select new
{
APPLICANT = j,
Profile = a,
}).Take(1000).AsEnumerable();
applicantdata = applicantList.AsEnumerable().ToList();
if (applicantdata.Any())
{
Cache.Set("applicants", applicantdata, 30);
}
}
return applicantdata;
}
这是错误
applicantdata = applicantList.AsEnumerable().ToList();
无法将类型“System.Collections.Generic.List<AnonymousType#1>”隐式转换为“System.Collections.Generic.IEnumerable<Applicant.Models.APPLICANT>”。存在显式转换(您是否缺少演员表?)