Hi,
I am experiencing the same issue.
Based on Ayende's blog:
http://ayende.com/Blog/archive/2009/04/29/nhibernate-ipreupdateeventlistener-amp-ipreinserteventlistener.aspx
I am adding the audit information in the PreUpdate/Insert event
listener.
However the difference is that I user I am adding is not a simple
string, but rather an entity with multiple many-to-many/one-to-many
collections.
I am getting the assert in <subj> when I am trying to flush the
data.
public bool OnPreUpdate(PreUpdateEvent @event)
{
var audit = @event.Entity as IDataEntity;
if (audit == null) return false;
UserPassport user = GetCurrentUserOrSystem(); // UserPassport is
entity containing collections
Debug.Assert(user != null);
DateTime time = DateTime.Now;
Set(@event.Persister, @event.State, "DateChanged", time);
Set(@event.Persister, @event.State, "UserChanged", user);
audit.DateChanged = time;
audit.UserChanged = user;
return false;
}
Is my code OK?
Is there something extra I must do in case when I am using the whole
entity not just a simple string?
I found a workaround here:
http://groups.google.sk/group/nhusers/browse_thread/thread/a886504d871a7cc/2b65f0d6df7fe77b?hl=en&q=collection+was+not+processed++flush+assert+nhibernate
which basically says that I should swallow the AssertionException in
the FlushEventListener. I am more interested in a explanation than
workaround though.
Thanks,
Stefan
--
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.