0

I have a Departments table, which has a foreign key column to Sites, on Department.SiteId = Sites.SiteId. Now in my EF model, my Departments entity doesn't have a Siteid attribute, just a reference to Sites. How do I select, in a LINQ query, all departments with a specific SiteId?

1 Answer 1

2
var query = from d in entities.Departments where d.Site.SiteId == theSiteId select d; 
Sign up to request clarification or add additional context in comments.

1 Comment

So simple, yet so elusive. Thanks! I was looking all over for SitesReference.EntityKey etc.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.