0

I'd like to configure NHibernate Envers so that only object deletes are audited. Is it possible?

kazakm
  • 31
  • 4

1 Answers1

0

I guess you can derive from AuditEventListener and override OnPostInsert, OnPostRecreateCollection, OnPostUpdate, OnPreRemoveCollection, OnPreUpdateCollection and in your impl do nothing in these methods (only keep base class' OnPostDelete impl). Then pass in this class as an argument to configuration.IntegrateWithEnvers([yourEventListenerHere], enversCfg).

However, Envers might be overkill for you (you cannot use its query API and other stuff if you just store delete info). Maybe a simple implementation of IPostDeleteEventListener is enough in your case (depending on what you want to store)?

Roger
  • 1,944
  • 1
  • 11
  • 17