EditableRootListBase (ERLB), clone and Exceptions

EditableRootListBase (ERLB), clone and Exceptions

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


xAvailx posted on Tuesday, June 09, 2009

CSLA 3.6.2, Winforms .Net 3.5

I am using the EditableRootListBase stereotype bound to a datagrid. I have an issue when an exception is raised from the data portal.

My scenario deals with concurrency, when a delete is attempted and a concurrency exception is thrown. The problem is the object is still marked for deletion AND is dirty after the exception is thrown and caught in the UI. So what happens is the user receives a messagebox saying the record was updated by someone else, fine no problem. Then if they try to edit other items in the grid, the update keeps firing for my "deleted/dirty" object which ofcourse, is still invalid.

The funny thing is we have another app using CSLA 3.5.x where this problem doesn't come up. Looking at the src for EditableRootListBase, i can see where in the older version in SaveItem it "AcceptChanges" the edits first and then it clones. The new version clones first, then "AcceptChanges". I haven't proved it yet, but I am guessing that is why it works ok in the old version, because it is not dirty when the clone takes place.

Anyone have any ideas on how to fix/workaround this issue?

xAvailx replied on Wednesday, June 10, 2009

I found somewhat of a workaround, after the concurrency exception is caught in the UI, i reload the list, thus all objects in the list are valid.

Copyright (c) Marimer LLC