Bug in CancelEdit CSLA Editable Child List

Bug in CancelEdit CSLA Editable Child List

Old forum URL: forums.lhotka.net/forums/t/3854.aspx


boo posted on Wednesday, November 07, 2007

Not sure if this has been reported.  To reproduce.

EditableParent, Contains EditableChildList.

Two properties in child object (that composes the list), X (read only string), Y (editable string).  The unique id of child object is based off a GUID.

In your unit test, create the parent, and add 2 items to the child list.  Save.

After the parent is old and not dirty, do a BeginEdit.

Clear the editable child list.

Do a CancelEdit.

Notice now that the items in the child list have swapped.

RockfordLhotka replied on Wednesday, November 07, 2007

Undeleting items from a list doesn't result in the items being returned to their original locations. While this could be a bug, I prefer to view it as a "feature" Wink [;)]

The reason, is that solving this is difficult, especially if you interleave adds, deletes and clears in arbitrary orders. It isn't clear where you'd undelete an item into the list if you've added (inserted) items above/below/near the original location of the item.

If you care about the order of items in the list, use SortedBindingList to get an ordered view of the items.

Copyright (c) Marimer LLC