I am trying to build a class like so...
public class IoCControllerFactory : DefaultControllerFactory
{
protected override IController GetControllerInstance(RequestContext request_context, Type controller_type)
{
// Attempt to resolve controller type.
IController resolvedController = null;
if (controller_type != null)
{
if (!typeof(IController).IsAssignableFrom(controller_type))
{
throw new ArgumentException(string.Format("Type requested is not a controller: {0}", controller_type.Name), "controller_type");
}
resolvedController = _container.Resolve(controller_type) as IController;
}
// Throw page not found if controller does not exist.
if (resolvedController == null)
{
throw new HttpException((int)HttpStatusCode.NotFound, "The requested page was not found.");
}
return resolvedController;
}
}
The method is trying to override an internal virtual method that has the followign signature (from .net assembly... i cant modify this)
protected internal virtual IController GetControllerInstance(
RequestContext requestContext,
Type controllerType
)
When i try to compile i get the following...
'XXX.Web.Mvc.IoCControllerFactory.GetControllerInstance(System.Web.Routing.RequestContext, System.Type)': no suitable method found to override
Everybody on the web seems to be able to do this just fine, is there something obvious that I am missing?