ChildChanged events when loading object in ObjectFactory

ChildChanged events when loading object in ObjectFactory

Old forum URL:

Kevin Fairclough posted on Thursday, January 20, 2011


I'm seeing strange behaviour in my business object with regard to ChildChanged.  If I handle this in my root BO and load the object via my factory I'm getting a lot of ChildChanged evenst raised, should this be happening or is there a problem with my Factory.





RockfordLhotka replied on Thursday, January 20, 2011

ChildChanged is raised when child objects change in the object graph, so what you are seeing is normal.

If you don't want the events to be raised, you need to turn off event handling on your collections (RaiseListChangedEvents to false) - though that won't entirely disable them - just the ones that trigger off collection changed events. There is no way to disable property changed events, and those can also cascade up as child changed events.

JonnyBee replied on Thursday, January 20, 2011

And if there's code in Child_Changed that you do not want to run during load yuo could check if ApplicationContext.LogicalExecutionLocation is Server or Client.

Kevin Fairclough replied on Monday, January 24, 2011

I originally looked at this because my rule wasn't being executed when a child object's property changed.  A scan of the forums lead me to believe I had to force the rule to run on the ChildChanged event.  This event as I now know fires even when the object is loading via the factory also, so I need to conditionally force the rule on the ChildChanged to stop it running more than it should.

ApplicationContext.LogicalExecutionLocation to the rescue!




Copyright (c) Marimer LLC