
■ CONTENTS
xvi
Creating the Example Project ................................................................................. 455
Creating a Custom Controller Factory .................................................................... 457
Dealing with the Fallback Controller .............................................................................. 459
Instantiating Controller Classes ..................................................................................... 460
Implementing the Other Interface Methods ................................................................... 460
Registering a Custom Controller Factory ....................................................................... 460
Working with the Built-In Controller Factory ......................................................... 461
Prioritizing Namespaces ................................................................................................ 462
Customizing DefaultControllerFactory Controller Instantiation ...................................... 463
Creating a Custom Action Invoker .......................................................................... 466
Using the Built-In Action Invoker ........................................................................... 468
Using a Custom Action Name ........................................................................................ 468
Using Action Method Selection ...................................................................................... 470
Improving Performance with Specialized Controllers ............................................ 476
Using Sessionless Controllers ........................................................................................ 476
Using Asynchronous Controllers .................................................................................... 478
Summary ................................................................................................................ 483
Chapter 18: Views .................................................................................................. 485
Creating a Custom View Engine ............................................................................. 485
Creating the Example Project ........................................................................................ 487
Creating a Custom IView ................................................................................................ 488
Creating an IViewEngine Implementation ...................................................................... 489
Registering a Custom View Engine ................................................................................ 490
Testing the View Engine ................................................................................................ 490
Working with the Razor Engine .............................................................................. 492
Creating the Example Project ........................................................................................ 493
Understanding Razor View Rendering ........................................................................... 493
Configuring the View Search Locations ......................................................................... 495
Adding Dynamic Content to a Razor View .............................................................. 498
Using Sections ............................................................................................................... 498
Using Partial Views ........................................................................................................ 504
Using Child Actions ........................................................................................................ 508
Summary ................................................................................................................ 510
Chapter 19: Helper Methods ................................................................................... 511