Here are a couple of suggestions, I hope they are of some help:
- Upgrade to CSLA 3.x. I beleive a lot of enhancements were made from 2.x to 3.x regarding edit levels, which made debugging them a lot easier. Since there are no major breaking changes, you might want to consider upgrading first and then retackling this issue.
- In the caseof your modal window. I take it you pass your object as a parameter to your window and bind/edit it in there. What you might be better off doing is call the UnbindBindingSource method (as per the PTracker example) on your parent window to unhook the object from any bindings. You could pass the apply flag as true/false, it shouldnt really matter. Then within your modal window bind and eventually unbind the object following the proven guidlines and finally, after closing the modal window bind the modified object back on your parent form.
Hope this helps...
triplea:Here are a couple of suggestions, I hope they are of some help:- Upgrade to CSLA 3.x. I beleive a lot of enhancements were made from 2.x to 3.x regarding edit levels, which made debugging them a lot easier. Since there are no major breaking changes, you might want to consider upgrading first and then retackling this issue.
- In the caseof your modal window. I take it you pass your object as a parameter to your window and bind/edit it in there. What you might be better off doing is call the UnbindBindingSource method (as per the PTracker example) on your parent window to unhook the object from any bindings. You could pass the apply flag as true/false, it shouldnt really matter. Then within your modal window bind and eventually unbind the object following the proven guidlines and finally, after closing the modal window bind the modified object back on your parent form.Hope this helps...
Thanks. :) I've mentioned to my boss about upgrading to CSLA 3.0.4. We'll see if that goes through.
Another thing I noticed in my testing. I did the ugly reflection stuff to see if I should call EndEdit(), so my EditLevels are now working correctly, however, sometimes when CancelEdit() is called explicitly on the business object it doesn't decrement the EditLevel. Is this a CSLA 2.1.1 bug as well?
The subtle change is this: prior to this change, a manual call to BeginEdit() would prevent a subsequent IEditableObject.BeginEdit() call from having any effect, leaving the object at edit level 1. With this change both the manual and IEditableObject calls will take effect, putting the object at edit level 2. In reality, this change makes the behavior more clear and consistent, but since it is a change it could break some code.
Copyright (c) Marimer LLC