Exemplo n.º 1
0
        public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller)
        {
            if (Controllers.ContainsKey(controller.ControllerName))
            {
                throw new RocketException($"There is already a controller with name: {controller.ControllerName} in module: {RootPath}");
            }

            return(Controllers[controller.ControllerName] = controller);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
 public ControllerApiDescriptionModel GetOrAddController(string uniqueName, string name, Type type, [CanBeNull] HashSet <Type> ignoredInterfaces = null)
 {
     return(Controllers.GetOrAdd(uniqueName, () => ControllerApiDescriptionModel.Create(name, type, ignoredInterfaces)));
 }