我有以下Linq查询我正在使用实体框架。
var res = from a in _db.Articles
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;
问题是我的机构类有一个名为“Type
”的变量,类型为“InstitutionType
”我需要包含,我不知道该怎么做。
答案 0 :(得分:10)
var res = from a in _db.Articles.Include("Authors")
.Include("Authors.Institution")
.Include("Authors.Institution.Type")
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;