title: Why is LINQ to SQL entity association creating a new (duplicate) row when inserting a new record?
body: <p>I am trying to insert a new entity using LINQ-to-SQL, and entity is associated with a User entity. The insert of the new entity is successful, but my existing User entity gets inserted as if it were a new User. The code looks something like the following:</p>
  
  <pre><code>var someEntity = new Entity();
  someEntity.User = this.User;
  dataContextInstance.SomeEntities.InsertOnSubmit(someEntity);
  dataContextInstance.SubmitChanges();
  </code></pre>
  
  <p>Does anyone know why the user is being inserted as a brand new entity into the Users table? It would seem that the User.UserId would become the foreign key value in the UserId column of the row mapped to the someEntity that is being inserted.</p>
  
  <p>Thanks for any help/suggestions/comments</p>