OnAddEventHooks / OnRemoveEventHooks

OnAddEventHooks / OnRemoveEventHooks

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

tiago posted on Sunday, May 13, 2012

Hi Jonny

On thread http://forums.lhotka.net/forums/p/11259/52348.aspx you said


Actually, there is 2 important procedures:

The purpose is to make the "parent" observe events in the child object and raise own events to notify UI / listeners of chenges.
This is necessary for the

events to work as expected.

It's necessary to make UI helpers like PropertyStatus / ObjectStatus / ReadWriteAuthorization to work as expected as they hook into one or more of these events.

Not exactly sure when these made it into the framework but they do exist in Csla 3.6 and forward.

I searched everywhere and found no information on how and when to use these methods. No sample uses them (how come?), no ebook mentions them, no info on the forum.

1) I guess the UI Helpers you mention are universal (meaning not WinForms exclusive). So these should be used for all UI technologies.

2) As far as I understood, OnAddEventHooks should be used when:

3) When I have an EditableRoot that contains an EditableChildCollection that is made of EditableChild objects, I must use OnAddEventHooks:


JonnyBee replied on Monday, May 14, 2012

1. The internal work that OnAddEventHooks/OnRemodeEventHooks do to make the parent object observe it's children is important to get f.ex OnChildChanged events to happen in all parents. You will normally not have to override or hook into these events nor do I recommend to expose these 2 methods to UI helpers.

2. OnAddEventHooks is called when a

3. Again - You should NEVER call this event. This event is automatically called by CSLA as needed -  your code may use this to customize some behavior of add hooks for your own custom events.


Copyright (c) Marimer LLC