BusinessListBase possible bug

BusinessListBase possible bug

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


Fabio posted on Thursday, January 04, 2007

Bo with list of childs in a BusinessListBase.
I work with grid, for childs, and object binding but i think this is not the matter.

BeginEdit the Bo
Delete some childs (N.B. without change any property of Bo and without change any child)
ApplyEdit of Bo
intent to Save the Bo

The Bo is not savable because:
1) The Bo isn't marked as Dirty (no properties was changed)
2) The BusinessListBase of childs is not Dirty because don't have dirty childs (no childs was changed) and the DeletedList is empty because AcceptChanges of list remove all child in the DeletedList.

Can, somebody, verify this ?
Thanks.
Fabio.


ajj3085 replied on Friday, January 05, 2007

Not a bug, something you must handle.  Your parent BO should be listening to events from child collections, and calling PropertyHasChanged( "NameOfCollectionProperty" ).  This will raise property changed events and mark the BO as dirty.

HTH
Andy

Fabio replied on Friday, January 05, 2007

mmmm...
There isn't a property changed and the BO change it's state when i delete a child because in that moment the child was added to the DeletedList of the ChildList.
This is because de IsDirty of the BO is:
return base.IsDirty || childList.IsDirty;

The problem occur when ApplyEdit of the ParentBO was executed before Save call.
The ApplyEdit cause DeletedList clear so the childList.IsDirty is = false and DeletedList is empty so i can't delete childs.
Note that: The list on the UI had removed the childs.


ajj3085 replied on Friday, January 05, 2007

Sounds like something else is wrong.  If the grid removed the child object, it should be appearing in the DeletedList.  ApplyEdit shouldn't be causing the DeletedList to clear unless the object was added after the new edit level.. that is, the object was added at edit level one, then deleted, and accept changes cause the edit level to go to 0.

Copyright (c) Marimer LLC