This is a continuation of my Introduction to ASP.NET MVC series. As I outlined before this is in an effort to write the book and keep blogging, I decided to write/blog the last chapter, Chapter 2. I am doing this so I can receive feedback on this chapter as early as possible. Because this chapter, in my opinion, is probably the most critical of the book, it defines the context around ASP.NET MVC and how it differs from ASP.NET Web Forms, as well as giving a historical perspective of the MVC pattern.
In the next several posts we will cover the following parts of Chapter 2 from the book:
- The Model-View-Controller Pattern
- ASP.NET MVC vs. ASP.NET Web Forms
- Installing the Prerequisites
- Your First ASP.NET MVC Project
- The Model
- The View
- The Controller
In ASP.NET MVC, the model referrers to your applications’ business layer or domain objects. These objects are responsible for persisting the state of your application, which is often, but note necessarily, stored in a database.
There really isn’t much to explain about the model as it relates to the ASP.NET MVC Framework, because it is based on your implementation and design of your business layer. You can use any design pattern, methodology, and or custom process to accomplish the creation of the model:
- DDD (Domain Driven Design)
- TDD (Test Driven Design)
- Repository Pattern
- Service Pattern
- Specification Pattern
- POCO (Plain Old CLR Object)
- LINQ To SQL
- ADO.NET Entity Framework
- Data Tables
- Your custom own business layer
- Any combination of the above.
The point behind all of this is to try to demonstrate that it is up to you to define the model. It is up to you to make the best decisions related to your requirements. It is up to you to make it as simple or as complex as needed. Everything is up to you, when we are talking about the M in MVC.
This post is licensed under a different license than the rest of my site. Copyright © Wiley Publishing Inc 2009.NET, asp.net mvc, Book, C#, Chapter 2, Web, Wrox