Sub Select에서 저장소를 호출하려고하면이 오류가 발생합니다. 방법 'System.Linq.IQueryable`1 [aaa.Models를 인식하지 못하는 엔티티에 LINQ :LINQ to Entities가 'System.Linq.IQueryable'메서드를 인식하지 못합니다.
IGrpTextRepository rep = new GrpTextRepository();
var query = new DetailViewModel
{
ViewDet = (from gh in _db.Grp
select new MultiDetailViewModel
{
Header = gh,
Txts = rep.FindAllLangTxtById(gh.GrpID)
}).ToList(),
Lang = _db.Language.ToList(),
};
내 인터페이스는 여기에
public interface IGrpTextRepository
{
IQueryable<GrpText> FindAllLangTxtById(int GrpID);
}
public class GrpTextRepository : IGrpTextRepository
{
DBEntities db = new DBEntities();
public IQueryable<GrpText> FindAllLangTxtById(int GrpID)
{
return (from lang in db.Language
join gtxts in db.GrpText on lang.LangID equals gtxts.LangID into jointxt
from fintxt in jointxt.DefaultIfEmpty()
where fintxt.GrpID == GrpID
select fintxt);
}
}
전체 오류 메시지
System.NotSupportedException입니다 .GrpText] FindAllLangTxtById (Int32) '메서드를 사용하고이 메서드는 저장소 식으로 변환 할 수 없습니다.
위시 나는 이것을 간결하게 설명 할 수 있습니다 ... 이미 IQueryable 인터페이스, 지연된 실행 및 표현식 트리에 대해 얼마나 알고 있습니까? – jfar