When I try to save changes to my BO, I get a ValidationException: Object is still being edited...
As I have no need in my application for undo, I do not make explicit calls to BO.BeginEdit.
Basically, my logic is as follows:
BO.SomeProperty = "new value";
BO.Save();
Am I missing a concept - or should I be looking for an error in my BO implementation?
When I examine BO.EditLevel, it has a value of 1.
This would suggest to me that BeginEdit has been called. As I mentioned in my previous post, I do not call BeginEdit explicitly in my code - so... what am I missing here?
If your object is bound to the user interface, then the calls to the IEditableObject interface by the data bindings are automatically raising the edit level of your object.
You have to unbind your object before saving it, and then rebind the result returned from saving afterwards. If you search the forum for CslaActionExtender or RebindUI, I think you'll find threads on this.
The Using CSLA .NET 3.0 ebook has a chapter specifically covering this sort of issue.
Based on that information, Miguel created the CslaActionExtender control for CSLA 3.6 to take care of most of the details - because it turns out to be a pain to deal with the unbind/rebind issues by hand.
CslaActionExtender is covered to some degree in the Expert 2008 Business Objects book, though that book doesn't have a specific focus on Windows Forms.
Thanks to all who responded - I have been able to get this working the help provided. Joe's post explained why my updates didn't seem to be persisting and I was using a dynamic editable list as a datasource for a listview - which explained the EditLevel != 0.
Copyright (c) Marimer LLC