views:

36

answers:

1

The DefaultControllerFactory contains three different methods:

  1. GetControllerInstance
  2. CreateController
  3. GetControllerType

When is each method executed in the request lifetime? I've seen custom controller factories where one of these methods is overridden and implemented but I can't seem to find details on the execution path of each one.

+1  A: 

CreateController gets called.
It first calls GetControllerType to figure out type of the controller, then passes this type to GetControllerInstance.

Because it is easier (and often enough) to (only) override GetControllerInstance (so that the logic behind selecting the type remains the same), you'd often see this happening.

GSerg