I'd like to configure NHibernate Envers so that only object deletes are audited. Is it possible?
Is there a way to track only object deletes in NHibernate Envers?
49 views Asked by kazakm At
1
I'd like to configure NHibernate Envers so that only object deletes are audited. Is it possible?
I guess you can derive from
AuditEventListenerand overrideOnPostInsert,OnPostRecreateCollection,OnPostUpdate,OnPreRemoveCollection,OnPreUpdateCollectionand in your impl do nothing in these methods (only keep base class'OnPostDeleteimpl). Then pass in this class as an argument toconfiguration.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
IPostDeleteEventListeneris enough in your case (depending on what you want to store)?