I am trying to attach a LINQ entity to the data context after I receive it from a form POST. However, all I get is the following exception:
An entity can onl
I solved by setting UpdateCheck=Never to my property in .Dbml file and context.entity.Attach(entity, true);
In the LinqToSQL designer set all of the Update Checks to Never and when you attach call it like so:
context.entity.Attach(entity, true);
Alternatively, you could also grab the entity from the db and change it using the data from the POSTed entity, then submit that as a change.
Try following:
dataContext.People.Attach(person);
dataContext.Refresh(RefreshMode.KeepCurrentValues, person);
dataContext.SubmitChanges();