Chapter 2. The Data Access Layer

Before starting to develop the functionality of the application that is specific to Mary's requirements, the focus will be on building the overall architecture for the three layers in the application. The architecture is independent of the requirements and provides all developers working on the project with a standard way of presenting data to the user, validating data, and saving data to the database. The first layer to be discussed is the data access layer (DAL). This layer manages communication between the database and the business logic layer.

One of my favorite new features in Visual Studio 2008 is LINQ to SQL. You can find plenty of material on the web covering this topic. www.asp.net has some great videos covering this topic, showing you how to quickly create classes that mimic your tables and then bind them to the GridView control to display them to the user. You can also enable insert, update, and delete in a GridView with little or no code. The demos are great, and LINQ to SQL truly helps with rapid application development. I have found that there aren't as many articles about integrating LINQ to SQL into a three-layered architecture. The samples usually have the user interface directly communicate with the entity classes created by the ORM Designer. This chapter covers the following:

  • Exploring options for creating a data layer

  • Walking through the traditional approach

  • Implementing a similar design pattern using LINQ to SQL

If this book ...

Get ASP.NET 3.5 Enterprise Application Development with Visual Studio® 2008: Problem - Design - Solution now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.