コード例 #1
0
        private void ConfigureArea(ControllerModel controller, [CanBeNull] MajidControllerAssemblySetting configuration)
        {
            if (configuration == null)
            {
                return;
            }

            if (controller.RouteValues.ContainsKey("area"))
            {
                return;
            }

            controller.RouteValues["area"] = configuration.ModuleName;
        }
コード例 #2
0
        private void ConfigureSelector(ControllerModel controller, [CanBeNull] MajidControllerAssemblySetting configuration)
        {
            RemoveEmptySelectors(controller.Selectors);

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

            var moduleName = GetModuleNameOrDefault(controller.ControllerType.AsType());

            foreach (var action in controller.Actions)
            {
                ConfigureSelector(moduleName, controller.ControllerName, action, configuration);
            }
        }
コード例 #3
0
 private void ConfigureRemoteService(ControllerModel controller, [CanBeNull] MajidControllerAssemblySetting configuration)
 {
     ConfigureApiExplorer(controller);
     ConfigureSelector(controller, configuration);
     ConfigureParameters(controller);
 }
コード例 #4
0
        private void AddMajidServiceSelector(string moduleName, string controllerName, ActionModel action, [CanBeNull] MajidControllerAssemblySetting configuration)
        {
            var majidServiceSelectorModel = new SelectorModel
            {
                AttributeRouteModel = CreateMajidServiceAttributeRouteModel(moduleName, controllerName, action)
            };

            var verb = configuration?.UseConventionalHttpVerbs == true
                           ? ProxyScriptingHelper.GetConventionalVerbForMethodName(action.ActionName)
                           : ProxyScriptingHelper.DefaultHttpVerb;

            majidServiceSelectorModel.ActionConstraints.Add(new HttpMethodActionConstraint(new[] { verb }));

            action.Selectors.Add(majidServiceSelectorModel);
        }
コード例 #5
0
        private void ConfigureSelector(string moduleName, string controllerName, ActionModel action, [CanBeNull] MajidControllerAssemblySetting configuration)
        {
            RemoveEmptySelectors(action.Selectors);

            var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault <RemoteServiceAttribute>(action.ActionMethod);

            if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(action.ActionMethod))
            {
                return;
            }

            if (!action.Selectors.Any())
            {
                AddMajidServiceSelector(moduleName, controllerName, action, configuration);
            }
            else
            {
                NormalizeSelectorRoutes(moduleName, controllerName, action);
            }
        }