title: Entity Framework Code First Find vs SingleOrDefault (Eager Loading)
body: <p>I'm using Entity Framework 4.2 (Code First) to access my database. I was under the assumption that if I queried an entity using <code>SingleOrDefault</code> it would only query the database if the entity was not already being tracked, but this does not appear to be the case. The <code>Find</code> method on the other hand, does appear to be doing this. The problem with <code>Find</code> is that it doesn't appear to allow me to load related data.</p>
  
  <p>Is there a way to use the <code>Find</code> method but also eagerly load data ? As an example, I want to load a book and all of its reviews:</p>
  
  <pre><code>// Load book from the database
  Book book = context.Books.Find(1); 
  context.Entry&lt;Book&gt;(book).Collection&lt;Review&gt;.Load(); // Book.Reviews is now populated
  
  // Load book from the change tracker
  // This will include all Reviews as well
  Book book2 = context.Books.Find(1);
  </code></pre>
  
  <p>With <code>SingleOrDefault</code> I can load the Reviews when I get the book using Include:</p>
  
  <pre><code>// Load book + reviews from the database
  Book book = Book.Include("Reviews").SingleOrDefault(b =&gt; b.Id == 1);
  
  // Doing the same thing again requeries the database
  Book book2 = Book.Include("Reviews").SingleOrDefault(b =&gt; b.Id == 1);
  </code></pre>
  
  <p>Is there a way to get the behavior of <code>Find</code> with the eager loading of <code>SingleOrDefault</code> ?</p>