I´m trying to update a db record using linq to sql
First i query for it
MyObject obj = (from o in objRepository.List where(o.ID == id) select i).SingleOrDefault();
then I try to update and modify the data
obj.Name = "some value"
dataContext.Attach(obj)
dataContext.Context.Refresh(RefreshMode.KeepCurrentValues, obj);
I'm getting an InvalidOperationException
on the line where the content is attached.
It says that its impossible to attach an Entity that already exists.
Can anyone please help me? Thank you.