[英]Entity framework linq include
我有以下使用實體框架的Linq查詢。
var res = from a in _db.Articles
from auth in a.Authors
where papers.Contains(a.JoomlaId)
select auth.Institution;
問題是我的機構類有一個需要包含的“ InstitutionType
”類型的名為“ Type
”的變量,我不知道該怎么做。
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;
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.