Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="attr"></param>
        private void ConfigureArea(ControllerModel controller, DynamicWebApiAttribute attr)
        {
            if (attr == null)
            {
                throw new ArgumentException(nameof(attr));
            }

            if (!controller.RouteValues.ContainsKey("area"))
            {
                if (!string.IsNullOrEmpty(attr.Module))
                {
                    controller.RouteValues["area"] = attr.Module;
                }
                else if (!string.IsNullOrEmpty(AppConsts.DefaultAreaName))
                {
                    controller.RouteValues["area"] = AppConsts.DefaultAreaName;
                }
            }
        }
Exemple #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="controller"></param>
        /// <param name="controllerAttr"></param>
        private void ConfigureSelector(ControllerModel controller, DynamicWebApiAttribute controllerAttr)
        {
            RemoveEmptySelectors(controller.Selectors);

            if (controller.Selectors.Any(selector => selector.AttributeRouteModel != null))
            {
                return;
            }

            var areaName = string.Empty;

            if (controllerAttr != null)
            {
                areaName = controllerAttr.Module;
            }

            foreach (var action in controller.Actions)
            {
                ConfigureSelector(areaName, controller.ControllerName, action);
            }
        }
Exemple #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="controller"></param>
 /// <param name="controllerAttr"></param>
 private void ConfigureDynamicWebApi(ControllerModel controller, DynamicWebApiAttribute controllerAttr)
 {
     ConfigureApiExplorer(controller);
     ConfigureSelector(controller, controllerAttr);
     ConfigureParameters(controller);
 }