O'Reilly logo

Professional ASP.NET Design Patterns by Scott Millett

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

Chapter 7. The Data Access Layer

WHAT'S IN THIS CHAPTER?

  • Two data access strategies to help organize your persistence layer: Repository and Data Access Objects

  • Data patterns and principles to help you fulfill your data access requirement needs elegantly, including Lazy Loading, Identity Map, Unit of Work, and Query Object

  • An introduction to object relational mappers and the problems they solve

  • An enterprise domain-driven exercise with POCO business entities utilizing both NHibernate and the MS Entity Framework

So far, you have read about the business layer of an enterprise ASP.NET application, the patterns used to organize it, and the patterns found within. You then looked at the service layer, which gave an entry point into a system. This chapter focuses on the data access layer (DAL) and covers patterns that allow you to retrieve and persist your business entities, ensuring you leave your data in a valid state.

DESCRIBING THE DAL

The DAL is the layer in your application that is solely responsible for talking to the data store and persisting and retrieving your business objects. (Note the reference to a data store and not a database. You don't always have to have a database; sometimes an XML file is sufficient.) The DAL typically includes all the create, read, update, and delete (CRUD) methods, transaction management, data concurrency, as well as a querying mechanism to enable your business logic layer to retrieve objects for any given criteria.

The DAL should not contain business logic ...

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