Chapter 13

Extending MVC

— By Brad Wilson

What's In This Chapter?

  • How to extend Models
  • How to extend Views
  • How to extend Controllers

One of the lessons underlined in Chapter 1 is about the importance of the layers in the ASP.NET framework itself. When ASP.NET 1.0 came out in 2002, most people did not differentiate the core run time (that is, the classes in the System.Web namespace) from those of the ASP.NET Web Forms application platform (that is, the classes in the System.Web.UI namespace). The ASP.NET team built the complex abstraction of Web Forms on top of the simple abstraction of the core ASP.NET run time.

ASP.NET MVC is built on top of that core run time. Everything that's done by the MVC framework can be done by anybody (inside or outside of Microsoft) because it's built on these public abstractions. For the same reasons, the ASP.NET MVC framework is itself made up of several layers of abstractions. This enables developers to pick and choose the pieces of MVC they like and replace or extend the pieces they don't. With each successive version, the MVC team has opened up more of these customization points inside the framework itself.

Some developers won't ever need to know about the underlying extensibility of the platform; at best, they will use it indirectly by consuming a third-party extension to MVC. For the rest, the availability of these customization points are a critical factor in deciding how best to use MVC in their applications. This chapter is for those developers who wish to get a deeper understanding of how the pieces of MVC fit together, and the places we designed to be plugged into, supplemented, or replaced.

note
UnFigure

The full source code to all the samples in this chapter is available in the NuGet package named Wrox.ProMvc3.ExtendingMvc. Start with an empty MVC application, add the NuGet package to it, and you will have a several fully functional samples that are discussed in this chapter. This chapter shows only the important pieces of the sample code, so following along with the full source code from the NuGet package will be critical in understanding how these extension points work.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.137.163.208