title: How can I force a complete load along a navigation relationship in Entity Framework?
body: <p>Okay, so I'm doing my first foray into using the ADO.NET Entity Framework. </p>
  
  <p>My test case right now includes a SQL Server 2008 database with 2 tables, Member and Profile, with a 1:1 relationship.</p>
  
  <p>I then used the Entity Data Model wizard to auto-generate the EDM from the database. It generated a model with the correct association. Now I want to do this:</p>
  
  <pre><code>ObjectQuery&lt;Member&gt; members = entities.Member;
  IQueryable&lt;Member&gt; membersQuery = from m in members select m;
  foreach (Member m in membersQuery)
  {
     Profile p = m.Profile;
     ...
  }
  </code></pre>
  
  <p>Which halfway works. I am able to iterate through all of the Members. But the problem I'm having is that m.Profile is always null. The examples for LINQ to Entities on the MSDN library seem to suggest that I will be able to seamlessly follow the navigation relationships like that, but it doesn't seem to work that way. I found that if I first load the profiles in a separate call somehow, such as using entities.Profile.ToList, then m.Profile will point to a valid Profile.</p>
  
  <p>So my question is, is there an elegant way to force the framework to automatically load the data along the navigation relationships, or do I need to do that explicitly with a join or something else?</p>
  
  <p>Thanks</p>