Skip to content

Instantly share code, notes, and snippets.

@hvitorino
Created July 3, 2012 11:06
Show Gist options
  • Select an option

  • Save hvitorino/3039087 to your computer and use it in GitHub Desktop.

Select an option

Save hvitorino/3039087 to your computer and use it in GitHub Desktop.
Removendo notação húngara dos controllers
public class ControllerFactory : DefaultControllerFactory
{
public override IController CreateController(RequestContext requestContext, string controllerName)
{
IController controllerInstance = null;
var controllerType = GetControllerType(controllerName);
return base.GetControllerInstance(requestContext, controllerType);
}
private Type GetControllerType(string controllerName)
{
var controllerType = this.GetType().Assembly.GetTypes()
.Where(type => type.Name.ToLower() == controllerName.ToLower() && type.IsSubclassOf(typeof(Controller)))
.FirstOrDefault();
return controllerType;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment