O'Reilly logo

NHibernate 4.x Cookbook - Second Edition by Jason Dentler, Alexander Zaytsev, Gunnar Liljas

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Auditing data with Envers

A common business requirement in application development is auditing changes to stored entities. Which entities were added, modified, or deleted? Who made the change? Which properties were modified?

In this recipe, we'll use NHibernate Envers, which provides exactly that kind of auditing functionality.

Getting ready

Complete the Eg.Core model from Chapter 2, Models and Mappings.

How to do it…

  1. Create a new project named Eg.Envers.
  2. Copy the Eg.Core model and mappings from Chapter 2, Models and Mappings to this new project.
  3. Change the namespace and assembly references in the mappings to Eg.Envers.
  4. Install NHibernate Envers using NuGet Package Manager Console, by executing the following command:
    Install-Package NHibernate.Envers ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required