title: Insert new child+parent with LINQ2SQL
body: <p>struggling with LINQ2SQL, I'm new to it, and so far it's been ok, but this problem is really causing me grief.</p>
  
  <p>I've got two objects, Parent and Child, defined as such</p>
  
  <pre><code>[Table(Name="Parent")]
  public class Parent
  {
      [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
      public int ParentID { get; set; }
  
      [Association(OtherKey = "ParentID")]
      protected EntitySet&lt;Child&gt; _children = new EntitySet&lt;Child&gt;();
      public IList&lt;Child&gt; Children
      { 
          get { return _children.ToList(); }
          set { _children (value); }
      }
  }
  
  [Table(Name="Child")]
  public class Child
  {
      [Column(IsPrimaryKey = true, IsDbGenerated = true, AutoSync = AutoSync.OnInsert)]
      public int ChildID { get; set; }
      [Association(OtherKey = "ParentID", IsForeignKey=true)]
      [Column] public int ParentID { get; set; }
  
  }
  </code></pre>
  
  <p>Basics of what I'm then doing are</p>
  
  <pre><code>Parent newParent = new Parent();
  Child newChild = new Child();
  newParent.Children.Add(newChild);
  parentTable.InsertOnSubmit(newParent);
  parentTable.Context.SubmitChanges();
  </code></pre>
  
  <p>If I remove the relationship between the two tables in the DB and save, they save ok. Except that the ParentID in the Child record always stays as 0.</p>
  
  <p>If I create the relationship in the DB and try to save, it fails, obviously because the Child have a ParentID of 0 would break referential integrity.</p>
  
  <p>Even if I modify the above to be;</p>
  
  <pre><code>Parent newParent = new Parent();
  Child newChild = new Child();
  newChild.ParentID = newParent.ParentID;
  newParent.Children.Add(newChild);
  parentTable.InsertOnSubmit(newParent);
  parentTable.Context.SubmitChanges();
  </code></pre>
  
  <p>Why is this not working? What am I missing in Linq2SQL?</p>
  
  <p>Any help much appreciated!</p>