I'm implementing auditing of inserts so I've implemented
IPreInsertEventListener and it's firing as I would expect however I'm
trying to create a new Audit record in the same database with details
of the record that was originally being created (via SaveAndFlush()).
An exception "Collection was modified; enumeration operation may not
execute." is being thrown and the transaction is rolled back. I tried
creating a child session for the audit record but that didn't seem to
make any difference. Does anyone have an example how to do this or
what I might be doing wrong?
public bool OnPreInsert(PreInsertEvent e)
{
Audit audit = new Audit();
audit.CreatedBy = "somename";
audit.CreatedDateTime = DateTime.Now;
<<others snipped>>
audit.Save();
return false;
}
Many Thanks
--
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.