1

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.

3
  • 10
    Don't call your variable "type", your future self will kill you Commented Jun 24, 2013 at 22:08
  • You do have a point, i don't deny it but if i call it InstitutionType, it will be like Institution.InstitutionType which doesn't seam ok either. Commented Jun 24, 2013 at 22:15
  • AssociatedType? I would try programmers exchange, institutiontype sounds good to me though, it doesnt sound like a static type Commented Jun 24, 2013 at 22:21

1 Answer 1

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;
Sign up to request clarification or add additional context in comments.

1 Comment

Should have been 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; Can u please edit so i can mark it as an answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.