title: Entity Framework: saving related entities
body: <p>I've got two entities that have a 1-many relation but also a 1-1 relation.</p>
  
  <p>Here's a simple illustration:</p>
  
  <pre><code>class Parent
  {
      public Int32 Id { get; set; }
      public List&lt;Child&gt; Children { get; set; }
      public Int32 LastChildId { get; set; }
      public Child LastChild { get; set; }
  }
  
  class Child
  {
      public Int32 Id { get; set; }
      public Int32 ParentId { get; set; }
  }
  </code></pre>
  
  <p>And an instantiation:</p>
  
  <pre><code>var c1 = new Child() { };
  var c2 = new Child() { };
  
  var p = new Parent()
  {
      Children = new List&lt;Child&gt; { c1, c2 },
      LastChild = c2
  };
  </code></pre>
  
  <p>Will Entity Framework keep the last child id after the Parent object <code>p</code> will be inserted into the db via the datacontext? </p>