views:

26

answers:

1

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?

+2  A: 
var query = 
    from d in entities.Departments
    where d.Site.SiteId == theSiteId
    select d;
Ben M
So simple, yet so elusive. Thanks! I was looking all over for SitesReference.EntityKey etc.
ProfK