title: An NHibernate audit trail that doesn't cause "collection was not processed by flush" errors
body: <p>Ayende has an article about how to implement a simple audit trail for NHibernate (<a href="http://ayende.com/Blog/archive/2009/08/30/avoid-soft-deletes.aspx" rel="noreferrer">here</a>) using event handlers.</p>
  
  <p>Unfortunately, as can be seen in the comments, his implementation causes the following exception to be thrown: <em>collection xxx was not processed by flush()</em></p>
  
  <p>The problem appears to be the implicit call to <em>ToString</em> on the dirty properties, which can cause trouble if the dirty property is also a mapped entity.</p>
  
  <p>I have tried my hardest to build a working implementation but with no luck.</p>
  
  <p>Does anyone know of a working solution?</p>