Implementing the repository pattern

This recipe is an implementation of the repository pattern which allows us to separate the usage of a database and its data from the act of reading that data.

Getting ready

We will be using 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 and updating data.

Open the Repository Pattern solution in the included source code examples.

Execute the database setup script from the code samples included with this recipe. This can be found in the DataAccess project within the Database folder.

How to do it...

  1. In the DataAccess project, add a new C# interface name IBlogRepository with the following ...

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.