O'Reilly logo

ASP.NET MVC 2 Cookbook by Richard Kimber, Andrew Siemer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding support for LINQ to SQL

In this recipe, we are going to take the initial base application that we built in the first recipe and add a LINQ to SQL data access layer to the project. As the first project didn't require a database, we will have to also create a database to support this application.

Getting ready

This recipe requires that you copy the existing code base from the previous recipe. We will work from that recipe and spot weld in the new LINQ to SQL data access. You will also need to add a reference to a library called AutoMapper. More information, as well as the DLL, can be found at http://automapper.codeplex.com/. Basically, AutoMapper will allow us to map our domain models to the ones generated by LINQ to SQL.

How to do it...

  1. The ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required