title: How to prevent lazy loading of entities that were already manually loaded when navigating a property in EntityFramework
body: <p><strong>Background:</strong>
  I am using EF4 and <code>ObjectContext</code>. To optimze retrieval of complex object hierarchies, I manually execute database queries and then use <code>ObjectContext.Translatey&lt;T&gt;(DataReader, entitySetName, mergeOptions.AppendOnly)</code> to turn data rows into entities. I then attach the entities to the <code>ObjectContext</code> with <code>Attach</code> method. This also fixes relations between entities.</p>
  
  <p><strong>The problem:</strong>
  After everything is loaded and set up I try to navigate from parent entity to a child entity (for example Parent.Childs.First()), but EF hits the database to load the kids, even though all the child entities are already present in the ObjectContext and EntitySet. It looks like the reason for this is that parent.Childs.IsLoaded is set to false which makes EF think that it still needs to load the relation.</p>
  
  <p><strong>Question:</strong>
  How can I tell EF that EntitySet has already been loaded?</p>
  
  <p>Is there a supported way to set <code>RelatedEnd.IsLoaded</code> to true. I wouldn't like to mess with the calling the <code>RelatedEnd.SetIsLoaded</code> internal method.</p>
  
  <p>I found a smilar question <a href="http://social.msdn.microsoft.com/Forums/en/adonetefx/thread/c8d7733c-da9b-4f25-9648-0c64cda9a8b1" rel="nofollow">here</a> but it relates to DbContext and has no satifying answer  ;-)</p>
  
  <p>Matra</p>