I've got a parent object that has a collection of child objects and I need to ensure a business rule for validation is run before child objects are persisted. I've got a cascade set up so that the child objects are automatically updated when the parent object is saved.
Is there a way to intercept the update of each child before it's saved in this scenario? I've looked into the ILifecycle OnUpdate, but it doesn't seem get called, and the documentation says that IValidatable is unpredictably called.
And IInterceptor doesn't seem to be quite right either because I'd need to move my validation code out to another object and because only one IInterceptor can be associated with a session I'd need to mix the validation code for all domain objects together in one class (have I understood this right?)
I'm getting a bit desparate here - can anyone enlighten me?
Cheers,
Symon.
|