public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller) { if (Controllers.ContainsKey(controller.ControllerName)) { throw new Exception($"There is already a controller with name: {controller.ControllerName} in module: {RootPath}"); } return(Controllers[controller.ControllerName] = controller); }
public ControllerApiDescriptionModel CreateSubModel(string[] actions) { var subModel = new ControllerApiDescriptionModel { Type = Type, Interfaces = Interfaces, ControllerName = ControllerName, Actions = new Dictionary <string, ActionApiDescriptionModel>() }; foreach (var action in Actions) { if (actions == null || actions.Contains(action.Key)) { subModel.AddAction(action.Key, action.Value); } } return(subModel); }
public ControllerApiDescriptionModel GetOrAddController(string uniqueName, string name, Type type, HashSet <Type> ignoredInterfaces = null) { return(Controllers.GetOrAdd(uniqueName, () => ControllerApiDescriptionModel.Create(name, type, ignoredInterfaces))); }