/// <summary> /// Adds all the routes for the specified controller type to the end of the route collection. /// </summary> /// <param name="controllerType">The controller type</param> public void AddRoutesFromController(Type controllerType) { if (!FrameworkControllerType.IsAssignableFrom(controllerType)) { return; } if (!PromotedControllerTypes.Contains(controllerType)) { PromotedControllerTypes.Add(controllerType); } }
/// <summary> /// Appends the routes from the controller to the promoted controller type list, /// optionally removing an already added type in order to add it to the end of the list. /// </summary> /// <param name="controllerType">The controller type.</param> /// <param name="reorderTypes">Whether to remove and re-add already added controller types.</param> private void AddRoutesFromControllerInternal(Type controllerType, bool reorderTypes = false) { if (!FrameworkControllerType.IsAssignableFrom(controllerType)) { return; } if (!OrderedControllerTypes.Contains(controllerType)) { OrderedControllerTypes.Add(controllerType); } else if (reorderTypes) { OrderedControllerTypes.Remove(controllerType); OrderedControllerTypes.Add(controllerType); } }