From 0ad31c40e1aa05af63e5d28a20bda31369762dd6 Mon Sep 17 00:00:00 2001 From: maliming Date: Wed, 11 Dec 2019 10:22:56 +0800 Subject: [PATCH] When RemoteService is disabled, the selector of the service or service method is no longer configured. Resolve #2369 --- .../Mvc/Conventions/AbpServiceConvention.cs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs index 87e77efa6d..9875ccd808 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs @@ -171,6 +171,13 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions { RemoveEmptySelectors(controller.Selectors); + var controllerType = controller.ControllerType.AsType(); + var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault(controllerType.GetTypeInfo()); + if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(controllerType)) + { + return; + } + if (controller.Selectors.Any(selector => selector.AttributeRouteModel != null)) { return; @@ -188,6 +195,12 @@ namespace Volo.Abp.AspNetCore.Mvc.Conventions { RemoveEmptySelectors(action.Selectors); + var remoteServiceAtt = ReflectionHelper.GetSingleAttributeOrDefault(action.ActionMethod); + if (remoteServiceAtt != null && !remoteServiceAtt.IsEnabledFor(action.ActionMethod)) + { + return; + } + if (!action.Selectors.Any()) { AddAbpServiceSelector(rootPath, controllerName, action, configuration);