Another approach to auditing involves tracking each change to an entity in a separate audit table. In this recipe, I'll show you how to use NHibernate to generate audit triggers for our entity tables.
Download uNHAddIns.dll from the Unofficial NHibernate AddIns project at http://code.google.com/p/unhaddins/. Save the file to your solution's Lib folder.
Create a new console application project with all standard NHibernate references, the standard NHibernate and log4net configuration, and the Eg.Core model from Chapter 1.
Add a reference to uNHAddIns.dll.