title: How do I navigate through multiple relationships using LINQ to Entities?
body: <p>I'm just starting out with LINQ to Entities, and I'm trying to replicate a search we currently do in a stored procedure as a LINQ to Entities query.  However, I can't seem to figure out the correct way to query properties of entities more than one "join" away from the starting point of my query.</p>
  
  <p>For example, say I have tables Campaign, CampaignLocation, and Location, which have foreign keys from Campaign to CampaignLocation, and CampaignLocation to Location.  Pretty standard many-to-many table configuration.  When I start writing my LINQ query like this:</p>
  
  <pre><code> var campaigns = from c in context.Campaign.CampaignLocation
  </code></pre>
  
  <p>that's as far in the association chain as I can go.  There doesn't seem to be a "Location" property available on "CampaignLocation" so that I can filter on properties of the Location.</p>
  
  <p>I tried using the LINQ join syntax like this:</p>
  
  <pre><code> var campaigns = from c in context.Campaign
                   join cl in context.CampaignLocation 
                     on c.CampaignID equals cl.CampaignID
  </code></pre>
  
  <p>But there doesn't seem to be a "CampaignID" property on the "cl" alias.  Which is really weird, there's a column named that on the table.  Is it not on the model object since it's the foreign key to the Campaign table?</p>
  
  <p>Where am I going wrong here, and what am I missing?</p>
  
  <p><strong>[UPDATE]</strong></p>
  
  <p>It looks like any integer columns I use for foreign keys are not being added as properties of the model objects.  The foreign key relationships are displayed, but the ID properties aren't there.  Is there any way to get the designer to add these properties to the model when I read the schema from the database?</p>