Capturing the audit data

In this recipe, we will be walking through how to add a seamless audit data to your objects with minimal effort.

Getting ready

We will be using the NuGet Package Manager to install the Entity Framework 4.1 assemblies.

The package installer can be found at

We will also be using a database for connecting to the data, and updating it.

Open the Improving Audit Data solution in the included source code examples.

How to do it...

  1. We start be writing out a test that will allow us to define the scope of our problem. In this case, we want our context to handle the data for auditable objects without the user input. We define it with the following code:
    using System; using System.Linq; using BusinessLogic; using ...

Get Entity Framework 4.1: Expert's Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.