nhibernatefluent-nhibernatesharp-architecturenhibernate-envers

Sharp Architecture + NHibernate Envers


Currently we are using Sharp Architecture 1.9.6. And we need to audit our domain classes. It seems comfortably to use NHibernate Envers for this task. But I couldn't configure Sharp Architecture to use this library. There were some errors but I solved almost all of these except one.

The error is in following:

For example, I have POCO class named "Document" and table "Documents" in DB. Also I've created table "Documents_AUD" and added attribute [Audited] to class "Document". So, if some object of class Document has changed, Envers must add data to "Documents_AUD" table. To do this Envers create (dynamically?) ovbject of another class - "Document_AUD". And here the error appears: "NHibernate.MappingException No Persister for Document_AUD".

And I don't know where to add mapping for Document_AUD.

Does somebody use Envers with Sharp Arch ? Can somebody share Envers + Sharp Arch configuration?

Thank you very much!


Solution

  • you can create the configuration yourself, configure Envers on it and pass it to NHibernateSession.AddConfiguration() instead of calling the Init method.