Data Conflict in LINQ

后端 未结 7 2082
不知归路
不知归路 2020-12-13 02:33

When making changes using SubmitChanges(), LINQ sometimes dies with a ChangeConflictException exception with the error message Row not found

7条回答
  •  被撕碎了的回忆
    2020-12-13 03:13

    I've gotten this error in a circumstance completely unrelated to what the error message describes.

    What I did was load a LINQ object via one DataContext, and then tried to SubmitChanges() for the object via a different DataContext - gave this exact same error.

    What I had to do was call DataContext.Table.Attach(myOldObject), and then call SubmitChanges(), worked like a charm.

    Worth a look, especially if you're of the opinion that there really shouldn't be any conflicts at all.

提交回复
热议问题