title: Entity Framework 4 - Difficulty understanding how cloning an entity works
body: <p>Hi I am trying to make a clone of an EF entity and then reinsert it into the context for saving back to a DB as a new row. Later when I have solved that, I would like to expand this to clone a full entity graph and save it. </p>
  
  <p>I have tried two code samples:</p>
  
  <p><a href="http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx" rel="nofollow">http://msmvps.com/blogs/matthieu/archive/2008/05/31/entity-cloner.aspx</a></p>
  
  <p><a href="http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/a967b44b-c85c-4afd-a499-f6ff604e2139/" rel="nofollow">http://social.msdn.microsoft.com/forums/en-US/adodotnetentityframework/thread/a967b44b-c85c-4afd-a499-f6ff604e2139</a></p>
  
  <p>which both seem to be working. I think the problem is my understanding of what is taking place. As I understand it, the clone process makes a detached clone of the target object, which I should be able to Attach or AddObject back to the context, and have the context save it to the DB where it will be automatically assigned a unique PK ID.</p>
  
  <p>The main thing confusing me is that when I clone my entity object and then look at the properties of the clone in debug mode, it seems like its navigation collections still apparently point to valid entities that the copied object points to. However the EntityState is Detached. Is this normal? I assumed that the clone object's navigation properties are pointing to the same objects as in the cloned object's graph. But the clone objects are 'Detached' and the cloned objects are 'Unchanged'.</p>
  
  <p>I'm sooo confused... any ideas?</p>