As mentioned in a previous post I am currently working on a web application that we are building on top of the ASP.NET MVC Framework. The framework allows for a very clean implementation of the MVC pattern.
Because there is a database behind the application we decided to use the ADO.NET Entity Framework to access this database with help from model classes. The Entity Framework is a modeling framework that enables developers to define a conceptual model of a database schema that closely aligns to a real world view of the information. Benefits include easier to understand and easier to maintain application code that is shielded from underlying database schema changes.
In theory this all makes perfectly sense, but you have to implement it as well. There are two resources that I want to pass on because they were an incredible help to us.
The first is the tutorial Creating Model Classes with the Entity Framework on www.asp.net. The goal of this tutorial is to explain how you can create data access classes using the Entity Framework when building an ASP.NET MVC application. This tutorial assumes no previous knowledge of the Entity Framework. By the end of this tutorial, you’ll understand how to use the Entity Framework to select, insert, update, and delete database records. And in my opinion this tutorial meets its goal.
The second is a sample application written by Brad Abrams and Lance Olson. You will find a link to the sample and a description in his article ASP.NET MVC Example Application over Northwind with the Entity Framework. The sample application is a little outdated, but still an excellent reference point.