ChangeConflictException in Linq to Sql
I receive "Row not found or changed exception".
System.Dat开发者_JS百科a.Linq.ChangeConflictException: Row not found or changed. at
System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode) at
System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
at System.Data.Linq.DataContext.SubmitChanges()
How I to tell what column causes the exception?
Thank you.
See How to: Retrieve Member Conflict Information (LINQ to SQL) if you just want code a code example.
By default in Linq2Sql, every property is included in the optimistic concurrency check. You can customize this behavior by setting the UpdateCheck
property of the Column
attribute in your Linq2Sql class to Always
(the default), Never
, or WhenChanged
to only include a column in the concurrency check if its value changed. It's covered in greater detail on MSDN: Optimistic Concurrency Overview (LINQ to SQL)
精彩评论