O'Reilly logo

Professional Enterprise .NET by Scott Millett, Jon Arking

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 8. "Mining" Your Own Business

With your business logic layer now in place it's time to turn your thoughts to how you are going to store the state of your business objects. In this chapter, you will learn about the various methods and patterns at your disposal that will enable you to seamlessly save the state of your business model via a data access layer.

You will learn about two data access patterns, namely the very simple Data Access Object pattern and a pattern that you have read about in the previous chapter, called the Repository pattern. To demonstrate these patterns, you will learn the basics of three popular object relational mappers: Microsoft's LinqToSQL, the Entity Framework, and the open source NHibernate.

Before we explore these frameworks, it's important to define the role of the data access layer. Then, you will find out what an object relational mapper is and what problems it can help you with in your development efforts.

What Is the Data Access Layer?

The data access layer, as shown in Figure 8-1, is the layer in your application that is solely responsible for talking to the data store (note the reference to a data store and not a database; you don't always have to have a database — sometimes an XML file will be sufficient) and persisting and retrieving your business objects. It typically includes all of the CRUD (create, read, update, and delete) methods as well as a querying mechanism to enable your business logic layer to retrieve objects for any given criteria. ...

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