I think you need to initialize events differently for collections. Did you
try InitializeCollectionEvent to tie thecollect to the event source.

Anybody else have any help?

John Davidson

On Wed, Oct 27, 2010 at 4:08 PM, Kendrick Abell <[email protected]>wrote:

> Thanks for the suggestion.  I tried hooking in listeners for
> IPreCollectionRecreateEventListener and IPreCollectionUpdateEventListener
> but neither fire before the validation check on the child's audit
> properties.  My unit test that's failing essentially does the following:
>
> Parent=CreateParent("Parent1")
> Parent.Children.Add(CreateChild("Child1"))
> Parent.Children.Add(CreateChild("Child2"))
> Session.SaveOrUpdate(Parent)
>
> (Note that I can create or update the childless parent with no persistence
> issues, and both pre-insert and pre-update events fire and set audit
> information correctly.)
>
> On the SaveOrUpdate call, OnPreInsert() is raised for the Parent object,
> but neither of the collection listeners are raised before the validation
> check throws an error on Child1.  Either way, I think this is probably not
> the approach I want to take because if the save is done on the child object
> and the parent is dirty, I want to update audit info on the parent before it
> is persisted.
>
> I may have to resort to setting the audit information in the business
> layer, but it seems like something I should be able to deal with in the
> persistence layer (I've always done it in my stored procs in past apps)
> without having to jump through too many hoops.
>
>
> On Tue, Oct 26, 2010 at 4:23 PM, John Davidson <[email protected]>wrote:
>
>> There is a separate set of listeners for collections.
>>
>> John Davidson
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to