catch (ChangeConflictException cce) { // Where DB is your database context foreach (ObjectChangeConflict occ in DB.ChangeConflicts) { MetaTable metatable = DB.Mapping.GetTable(occ.Object.GetType()); Debug.WriteLine("\nTable name: " + metatable.TableName); foreach (MemberChangeConflict mcc in occ.MemberConflicts) { Debug.WriteLine("Member: " + mcc.Member); Debug.WriteLine("\tCurrent value: " + mcc.CurrentValue); Debug.WriteLine("\tOriginal value: " + mcc.OriginalValue); Debug.WriteLine("\tDatabase value: " + mcc.DatabaseValue); } } throw; }
Technical blog with tips and tricks for everything and more...
Featured Post
Organize and rename photos by EXIF data with PowerShell
This PowerShell script organizes and renames all photos in a selected folder using EXIF data. It will also create thumbnails of the images i...
Thursday, March 13, 2014
Row not found or changed... meet ChangeConflictException handler!
Row not found or changed exceptions are frustrating... until now!
Labels:
C#
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment