Hi,
I'm trying to implement a simple swap routine of elements within an EditableChildCollection BO. The contents of the collection are EditableChild BO's. The code is located in the EditableChildCollection BO and looks like this...
Private
Sub SwapElements(ByVal indx1 As Integer, ByVal indx2 As Integer) Dim t As EditableChildBOt =
Me(indx2) Me.SetItem(indx2, Me(indx1)) Me.SetItem(indx1, t)End
SubPrior to this code running, IsDirty is false for the BO's at both indx1 and indx2. After it runs, IsDirty is True for both, even though nothing has changed except their location within the containing collection.
Why is this and how do I get these BO's "clean" again. I've tried setting RaiseListChangedEvents to false, and also using an explicit BeginEdit / ApplyEdit on each object as it is moved. No luck.
Thanks for your help. I'm using Version 2.02 of CSLA if that makes any difference.
BBM
Andy,
Thank you VERY MUCH for your help. I'm not sure I would have ever found the "Items" property on my own. When I wrote my post, I actually had already tried to use the default property for the collection (me(indx1)) and the "explicit" item property (me.item(indx1)) without success.
I'm still not exactly sure why "Items" works. The only thing I can think of is that the Item property must call SetItem() to do its work, which is really the SetItem override in BLB that you pointed out. So Items() must use some other method to set the collection contents that doesn't call SetItem and therefore doesn't run afoul of the DeletedList?
Like I say, I don't know if I would have ever discovered this difference between the Items and Item properties in BLB without your help. Very handy to know.
Thanks again.
BBM
Copyright (c) Marimer LLC