DefaultIfEmpty()
Right join my data にステートメントを追加すると、コントローラーで例外が発生します。.
これは私のコントローラーです:
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(new APPLICANT())
select new
{
APPLICANT = j,
Profile = a,
}).Take(1000).AsEnumerable();
applicantdata = applicantList.ToList();
if (applicantdata.Any())
{
Cache.Set("applicants", applicantdata, 30);
}
}
return applicantdata;
}
これは私が例外を取得する行です:
applicantdata = applicantList.ToList();
そして、これは例外です
タイプ 'System.Collections.Generic.List' を 'System.Collections.Generic.IEnumerable' に暗黙的に変換することはできません。明示的な変換が存在します (キャストがありませんか?)