Is there a known limitation around event listeners and inherited
classes?  I am using this event listener code:

        public bool OnPreUpdate(PreUpdateEvent preUpdateEvent)
        {
            AbstractDomainObject audit = preUpdateEvent.Entity as
AbstractDomainObject;
            if (audit != null)
            {
                Set(preUpdateEvent.Persister, preUpdateEvent.State,
"UpdateUser", SetUpdateUser(audit));
                Set(preUpdateEvent.Persister, preUpdateEvent.State,
"UpdateDate", SetUpdateDate(audit));
            }

            return false;
        }

        protected void Set(IEntityPersister persister, object[] state,
string propertyName, object value)
        {
            int index = Array.IndexOf(persister.PropertyNames,
propertyName);
            if (index >= 0)
            {
                try
                {
                    state[index] = value;
                }
                catch (Exception ex)
                {
                    _Log.Debug(ex.ToString());
                    throw;
                }
            }
            else
            {
                _Log.Debug("PropertyName: " + propertyName + " not
found in AuditEventListener.Set()");
            }

            return;
        }

It gets hit and fires the correct SQL updates for most of my
scenarios, but not in the following scenario (even though the event
gets hit and the data is populated correctly!):
1.  I'm updating an inherited class -AND-
2.  The only changes to the object prior to the event listener were on
fields defined on the child class.  The auditing fields are on the
parent class.  If the application changed a field on the parent class
prior to the event listener, this works no problem.

Any help would be appreciated.  Very strange that it would hit the
event, receive the updates, but not fire a SQL update.

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.

Reply via email to