Chapter 16. Extending the controller

 

This chapter covers

  • Understanding the controller extensibility points
  • Discovering the requirements for an action
  • Using action selectors
  • Creating custom action results
  • Reducing controller complexity with action results

You now know all the basics of ASP.NET MVC, and you understand all the parts necessary to build compelling web applications. Let’s go further. The ASP.NET MVC framework has a number of extensibility points built in, and this chapter focuses on those that can be used in controller classes. Not only does extending the controller provide flexibility, it also reduces complexity.

We’ll cover how the basic notion of a controller provides for extension. Then we’ll explore how to extend actions and how a controller selects them. Finally, we’ll develop a custom action result to reduce complexity in the action.

If, at the end of this chapter, you find that the extension points aren’t sufficient, you’re not out of luck—the MVC Framework gives you full control to implement your own controller, which could act radically differently than the one provided in the framework.

16.1. Controller extensibility

The default controller implementation comes with some specific ideas about how action methods are selected, executed, and extended. This functionality comes from the Controller base class in the ASP.NET MVC framework, which is the default implementation of the IController interface.

16.2. Controller actions

 
 
 

16.3. Action, authorization, and result filters

 
 

16.4. Action selectors

 
 

16.5. Using action results to reduce complexity

 

16.6. Summary

 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest