Chapter 6. Customizing and extending the ASP.NET MVC Framework
This chapter covers
- Customizing route handlers
- Creating your own controller factory
- Extending the controller
- Decorating controller actions for additional behavior
- Building and using custom view engines
One of the greatest aspects of ASP.NET MVC is its flexibility. The majority of the framework is built upon interfaces and abstract base classes, which enables unit testing of components in isolation. This also gives us the ability to substitute our own implementations of these features. ASP.NET MVC comes with functional default implementations, but sometimes these don’t meet our needs. Sometimes we don’t agree with the choices that Microsoft bakes in, and by customizing these components we are free to make our own choices.
In this chapter we’ll cover some of the extension points of the ASP.NET MVC Framework. We’ll surround their use with examples and mention the purpose of each one. By the end of the chapter, you will be familiar with most of the extensible components of ASP.NET MVC and how to apply them.
First we’ll examine URL routing. We’ll take a look at how it functions and then explore how to enhance it to behave differently.