/// <summary> /// Creates a new <see cref="IControllerDefinition"/> based on <paramref name="controllerType"/>. /// </summary> /// <param name="controllerType">Type of the controller from which to create the definition.</param> /// <returns>A new instance of <see cref="IControllerDefinition"/></returns> public IControllerDefinition Create(Type controllerType) { if (controllerType == null) { throw new ArgumentNullException("controllerType"); } var definition = new ControllerDefinition(); definition.Name = controllerType.GetProxyName(); definition.UrlName = controllerType.Name.ToLower().Replace("controller", string.Empty); definition.Type = typeof(ApiController).IsAssignableFrom(controllerType) ? ControllerType.WebApi : ControllerType.Mvc; foreach (var method in _actionProvider.GetMethods(controllerType)) { definition.ActionMethods.Add(_actionFactory.Create(definition, method)); } return(definition); }