Handling soft delete

In this recipe, we will cover how to implement a soft delete solution with the Entity Framework, leveraging an open source library of interceptors.

Getting ready

We will be using the NuGet Package Manager to install the Entity Framework 4.2 assemblies, and the Entity Framework Interceptors assemblies.

The package installer can be found at http://nuget.codeplex.com/.

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

We then the following command:

Install-Package Isg.EntityFramework.Interceptors.SoftDelete

Open the Improving Soft Delete solution in the included source code examples.

How to do it...

  1. We start by writing out a test that will allow us to define the scope of our problem. In this case, we want to ...

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.