I have registered a new route like this
context.MapRoute(
"Dashboard_default",
"Dashboard",
new { action = "Index", controller = "Dashboard`1" },
new[] { "SomeNamespace.Controllers" }
);
This route makes my CreateController method in my StructureMapControllerFactory to fail when trying to get the controller type, code below
try
{
var controllerType = base.GetControllerType(requestContext, controllerName);
if(controllerType.IsGenericType) {
// Some logic here
}
return ObjectFactory.GetInstance(controllerType) as IController;
}
catch (Exception)
{
return base.CreateController(requestContext, controllerName);
}
Has I done something wrong or does the default implementation of GetControllerType not support generic types? If so any suggestions on how to solve this?