Monday, August 1, 2011

[Tutorial] Code First with Entity Framework 4.1
Part4: Data Audit

All properties within objects managed by the Entity Framework can be audited. This is very helpful if you need to display changes to objects before saving them, cancel modifications by resetting the current value with the initial value or handling concurrency problems.

Entity Framework 4.1 permits accessing the following property versions of an entity:

  • Database Value
  • Original Value
  • Current Value

image

When executing the code above the different values for the Name property of the Manager class are displayed.

image

As you see, adding audit functionality to your applications is really quick to do, Entity Framework 4.1 contains already everything necessary to implement it very easily.


Share/Save/Bookmark