Пример #1
0
        public ControllerApiDescriptionModel AddController(ControllerApiDescriptionModel controller)
        {
            if (Controllers.ContainsKey(controller.Type))
            {
                throw new AbpException($"There is already a controller with type: {controller.Type} in module: {RootPath}");
            }

            return(Controllers[controller.Type] = 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);
        }
Пример #3
0
 public ControllerApiDescriptionModel GetOrAddController(string name, Type type, [CanBeNull] HashSet <Type> ignoredInterfaces = null)
 {
     return(Controllers.GetOrAdd(type.FullName, () => ControllerApiDescriptionModel.Create(name, type, ignoredInterfaces)));
 }