Пример #1
0
        private void ConfigureSelector(ControllerModel controller, AutoApiAttribute attribute)
        {
            if (controller.Selectors.Any(selector => selector.AttributeRouteModel != null))
            {
                return;
            }

            var areaName = string.Empty;

            if (attribute != null)
            {
                areaName = attribute.AreaName;
            }

            foreach (var action in controller.Actions)
            {
                ConfigureSelector(areaName, controller.ControllerName, action);
            }
        }
Пример #2
0
        private void ConfigureArea(ControllerModel controller, AutoApiAttribute attribute)
        {
            if (attribute == null)
            {
                throw new ArgumentException(nameof(attribute));
            }

            if (!controller.RouteValues.ContainsKey("area"))
            {
                if (!string.IsNullOrEmpty(attribute.AreaName))
                {
                    controller.RouteValues["area"] = attribute.AreaName;
                }
                else if (!string.IsNullOrEmpty(PlusConsts.DefaultAreaName))
                {
                    controller.RouteValues["area"] = PlusConsts.DefaultAreaName;
                }
            }
        }
Пример #3
0
 private void ConfigureAutoApi(ControllerModel controller, AutoApiAttribute attribute)
 {
     ConfigureApiExplorer(controller);
     ConfigureSelector(controller, attribute);
     ConfigureParameters(controller);
 }