Entity framework linq include

asp.net-mvc c# entity-framework mysql

Question

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.

1
1
6/10/2015 7:33:21 PM

Accepted Answer

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;
10
6/24/2013 10:58:35 PM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow