To add audit trail to our application, we decided to use NHibernate.Envers. To enable application-specific change tracking, DefaultRevisionEntity been extended with user data.
public virtual void NewRevision( object revisionEntity ) { var revisionData = revisionEntity as Revision; if( revisionData != null ) {
Envers decides to use a RevisionListener depending on the RevisionEntity attribute that your class is decorated with:
[RevisionEntity( typeof( RevisionListener ) )]
I use the ServiceLocator template to enter my access in the RevisionListener . This is currently the only place I have to use ServiceLocator and really want to get rid of it.
Is there any other flexible way to insert my UserAccessor into RevisionEntity?
source share