Browse Source
Merge pull request #22577 from abpframework/auto-merge/rel-9-1/3618
Merge branch rel-9.2 with rel-9.1
pull/22578/head
maliming
10 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
22 additions and
7 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs
|
|
|
@ -16,6 +16,8 @@ public class AbpAspNetCoreMvcOptions |
|
|
|
|
|
|
|
public bool ExposeIntegrationServices { get; set; } = false; |
|
|
|
|
|
|
|
public bool ExposeClientProxyServices { get; set; } = false; |
|
|
|
|
|
|
|
public bool AutoModelValidation { get; set; } |
|
|
|
|
|
|
|
public bool EnableRazorRuntimeCompilationOnDevelopment { get; set; } |
|
|
|
|
|
|
|
@ -74,16 +74,29 @@ public class AbpServiceConvention : IAbpServiceConvention, ITransientDependency |
|
|
|
|
|
|
|
protected virtual void RemoveIntegrationControllersIfNotExposed(ApplicationModel application) |
|
|
|
{ |
|
|
|
if (Options.ExposeIntegrationServices) |
|
|
|
if (!Options.ExposeIntegrationServices) |
|
|
|
{ |
|
|
|
return; |
|
|
|
var integrationControllers = GetControllers(application) |
|
|
|
.Where(c => IntegrationServiceAttribute.IsDefinedOrInherited(c.ControllerType)) |
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
application.Controllers.RemoveAll(integrationControllers); |
|
|
|
} |
|
|
|
|
|
|
|
if (!Options.ExposeClientProxyServices) |
|
|
|
{ |
|
|
|
var clientProxyServiceControllers = GetControllers(application) |
|
|
|
.Where(c => IsClientProxyService(c.ControllerType)) |
|
|
|
.ToArray(); |
|
|
|
|
|
|
|
application.Controllers.RemoveAll(clientProxyServiceControllers); |
|
|
|
} |
|
|
|
|
|
|
|
var integrationControllers = GetControllers(application) |
|
|
|
.Where(c => IntegrationServiceAttribute.IsDefinedOrInherited(c.ControllerType)) |
|
|
|
.ToArray(); |
|
|
|
} |
|
|
|
|
|
|
|
application.Controllers.RemoveAll(integrationControllers); |
|
|
|
protected virtual bool IsClientProxyService(Type controllerType) |
|
|
|
{ |
|
|
|
return typeof(IApplicationService).IsAssignableFrom(controllerType) && |
|
|
|
controllerType.GetBaseClasses().Any(x => x.IsGenericType && x.GetGenericTypeDefinition().FullName!.StartsWith("Volo.Abp.Http.Client.ClientProxying.ClientProxyBase")); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual IList<ControllerModel> GetControllers(ApplicationModel application) |
|
|
|
|