I am trying to insert a new object using LINQ-to-SQL, and the entity is associated with a User object. Inserting a new object was successful, but my existing user object is inserted as if it were a new user. The code looks something like this:
var someEntity = new Entity(); someEntity.User = this.User; dataContextInstance.SomeEntities.InsertOnSubmit(someEntity); dataContextInstance.SubmitChanges();
Does anyone know why the user is inserted as a new entity into the Users table? It would seem that User.UserId will become the value of the foreign key in the UserId column of the row associated with the someEntity insert.
Thanks for any help / suggestions / comments
mkelley33
source share