Chapter 8. Advanced Data
The main focus throughout this book so far has been on the key components of ASP.NET MVC: the model, view, and controller. This chapter switches the focus to the data access layer and shows how to leverage the repository and object relational mapping data access patterns when building ASP.NET MVC web applications.
Data Access Patterns
One of the key features of the ASP.NET MVC Framework is extensibility. The framework was designed to give developers lots of flexibility to plug in different components and frameworks. Since ASP.NET MVC is built on top of .NET 4.5, any of the popular data access frameworks—including ADO.NET, LINQ to SQL, ADO.NET Entity Framework, or NHibernate—can be used in building the data access layer for an application.
No matter which data access framework you choose, it’s important to understand the key data access design patterns that complement the Model-View-Controller pattern.
Plain Old CLR Objects
A Plain Old CLR Object (POCO) is a .NET class that is used to represent a business entity (model) class. The class focuses on the key business attributes (properties) and behaviors (methods) of a business entity and its associated entities, without requiring any specific database infrastructure code.
The main goal behind using POCO classes is to design the application’s business model to have persistence ignorance (PI). This design approach allows the application’s business model to evolve independently of its data access model. Since the business ...