OnChildChanged Called On First Change Only

OnChildChanged Called On First Change Only

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

thaehn posted on Monday, June 17, 2013

I have a dynamic list that hosts a list of root business objects. The objects are displayed on an Outlook style calendar. When an item is changed the first time, the OnChildChanged is called and processes as expected. The business object changes are saved and all is good. The next change, however, OnChildChanged isn't called and the changes are again saved to disk. Every time the business object is changed after the initial one OnChildChanged is not called.  When I change a different business object (for the first time) the OnChildChanged is called.  When I then go back and change the one that was previously changed, the OnChildChanged is still not called.  It seems to get called one time for each business object and that is it.  I believe that I am running on CSLA 4.3’s latest build.

JonnyBee replied on Monday, June 17, 2013


Whenever an object is changed you will get a new instance back. It seems like your eventhandler is still attached to the original object - not the new object that was returned from Save. How do you attach to the items event? 

thaehn replied on Tuesday, June 18, 2013


I am not doing anything when they modify the object through the control. When the calendar control changes the business object, it is saved automatically. I am depending on the framework to wire up everything. If they double-click and bring up a dialog box, then I am saving the object. After it is saved, I update the current object with the changes returned from the save though a helper method on the current object (there are only a couple things they can change like start and end dates.  It is getting updated correctly becuase I can see the changes on the calendar.  In both case, only the first time a change is made is the OnChildChanged called.


JonnyBee replied on Wednesday, June 19, 2013


Can you provide us a small sample to showcase the issue? 

JonnyBee replied on Saturday, June 29, 2013

Hi Todd, 

Yes, you are correct that the event hooks is not set correctly on a saved item. 

See: https://github.com/MarimerLLC/csla/issues/171

Copyright (c) Marimer LLC