Last year I wrote an ASP.NET MVC 1.0 tutorial that was
published both online and in a book. The tutorial walked through
creating a simple application, called “NerdDinner”, which provides an easy way
for people to organize, host and RSVP for dinners online. You can read my
original ASP.NET V1 NerdDinner tutorial here. An updated version of the tutorial is also
included in the new Professional ASP.NET MVC 2 book.
The NerdDinner tutorial used a “database first approach”
where the database schema was defined first, and then we used a Visual Studio
designer to create our LINQ to SQL / LINQ to Entities model objects that mapped
to it.
Below I’m going to demonstrate how we could instead use a
“code first approach” using EF4 to build the NerdDinner model layer and
database schema, and construct a CRUD application using ASP.NET MVC.
We will walkthrough building this application
step-by-step. A download link to a completed version of the sample is
available at the end of this blog post.