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
parent
commit
cba1ad1ec9
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.cs
  2. 27
      framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

2
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpAspNetCoreMvcOptions.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; }

27
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/Conventions/AbpServiceConvention.cs

@ -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)

Loading…
Cancel
Save