简体   繁体   中英

Entity framework linq include

I have the following Linq query I'm working with entity framework.

var res = from a in _db.Articles
                  from auth in a.Authors
                  where papers.Contains(a.JoomlaId)
                  select auth.Institution;

The problem is that my institution class has a variable named " Type " of type " InstitutionType " that I need to include, and I have no idea how to do that.

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM