C# Class Rebel.Cms.Web.Mvc.ControllerFactories.PluginControllerFactory

Controller factory used for finding and instantiating plugin controllers
Since the DefaultControllerFactory in MVC performs some very aggressive caching of controllers in a cache file which persists app pool restarts. The subsystem queries the bin folder for changes made to the controllers but since plugin controllers aren't in the bin folder if they are loaded in the CodeGen folder they don't get updated, therefore this factory is required in order to ensure that plugin controllers don't get 'stale'
Inheritance: System.Web.Mvc.DefaultControllerFactory, IFilteredControllerFactory
Mostra file Open project: RebelCMS/rebelcmsxu5

Public Methods

Method Description
CanHandle ( System.Web.Routing.RequestContext request ) : bool

This factory will attempt to return the controller only if the PluginManager is using the CodeGen folder andthe route values contains both the 'Namespaces' and 'rebel' data tokens in its route values.

PluginControllerFactory ( IRebelApplicationContext applicationContext ) : System

Protected Methods

Method Description
GetControllerType ( System.Web.Routing.RequestContext requestContext, string controllerName ) : Type

Returns the controller type for the specified controllerName based on the RouteData specified.

Since this factory should only fire for plugin controllers, we just check for the Namespace token and look it up in our cache, if it doesn't exist there, we'll check the BuildManager since we know we've registered it with that on pre app init. If nothing is found, then we'll just revert to using the base classes implementation.

Method Details

CanHandle() public method

This factory will attempt to return the controller only if the PluginManager is using the CodeGen folder andthe route values contains both the 'Namespaces' and 'rebel' data tokens in its route values.
public CanHandle ( System.Web.Routing.RequestContext request ) : bool
request System.Web.Routing.RequestContext
return bool

GetControllerType() protected method

Returns the controller type for the specified controllerName based on the RouteData specified.
Since this factory should only fire for plugin controllers, we just check for the Namespace token and look it up in our cache, if it doesn't exist there, we'll check the BuildManager since we know we've registered it with that on pre app init. If nothing is found, then we'll just revert to using the base classes implementation.
protected GetControllerType ( System.Web.Routing.RequestContext requestContext, string controllerName ) : Type
requestContext System.Web.Routing.RequestContext
controllerName string
return System.Type

PluginControllerFactory() public method

public PluginControllerFactory ( IRebelApplicationContext applicationContext ) : System
applicationContext IRebelApplicationContext
return System