Created
February 26, 2012 17:50
-
-
Save kevinpang/1917941 to your computer and use it in GitHub Desktop.
StructureMapControllerFactory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StructureMapControllerFactory : DefaultControllerFactory | |
{ | |
public override IController CreateController(RequestContext requestContext, string controllerName) | |
{ | |
try | |
{ | |
var controllerType = base.GetControllerType(requestContext, controllerName); | |
return ObjectFactory.GetInstance(controllerType) as IController; | |
} | |
catch (Exception) | |
{ | |
//Use the default logic | |
return base.CreateController(requestContext, controllerName); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment