I have a NHibernate Interceptor that is set in the HibernateTemplate using Spring.Net (I'm using ASP.NET MVC, fwiw), which is used for Auditing. However, for some reason, while the OnLoad method is being triggered when I call genericDAO.Get(id), when I try to save something using genericDAO.SaveOrUpdate(object) neither the OnSave or OnFlushDirty Interceptor methods are called. Anyone know why this might be?
I've set breakpoints on the methods within VS debugger, so I'm pretty certain the Interceptor is set and that I'm not missing any method calls. Obviously, everything is being saved and retrieved correctly too.
public class AuditInterceptor
: EmptyInterceptor
{
public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types)
{
// Implementation
// Called when using genericDAO.Get(id)
}
public override bool OnSave(Object entity, Object id, Object[] state,
String[] propertyNames, IType[] types)
{
// Implementation
// NOT called when using genericDAO.SaveOrUpdate(entity)
}
public override bool OnFlushDirty(Object entity, Object id,
Object[] currentState, Object[] previousState,
String[] propertyNames, IType[] types)
{
// Implementation
}
}