title: How to cache a lazy-loaded property
body: <p><strong>Background:</strong></p>
  
  <p>I have two tables <code>master</code> and <code>detail</code>. each row in <code>detail</code> contains propertyof <code>master</code> (lazy load).</p>
  
  <p>I want to cache a collection of <code>detail</code> with their masters in a collection like the following:</p>
  
  <pre><code>List&lt;Detail&gt; cachedItems = entities.Details.ToList();
  
  foreach (var d in cachedItems)
      d.master // throws exception 
  </code></pre>
  
  <blockquote>
    <p>The ObjectContext instance has been disposed and can no longer be used for operations that require a connection.</p>
  </blockquote>
  
  <p><strong>The question:</strong></p>
  
  <p>How can I cache the <code>master</code> object with the <code>detail</code> object without using another collection and I prefer to get them in one round-trip.</p>