maliming
5 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
3 changed files with
8 additions and
6 deletions
-
framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AspNetCoreApiDescriptionModelProvider.cs
-
framework/src/Volo.Abp.Http.Client/Volo/Abp/Http/Client/ClientProxying/CurrentApiVersionInfo.cs
-
framework/src/Volo.Abp.Http/Volo/Abp/Http/Modeling/ModuleApiDescriptionModel.cs
|
|
|
@ -88,6 +88,7 @@ public class AspNetCoreApiDescriptionModelProvider : IApiDescriptionModelProvide |
|
|
|
_options.ControllerNameGenerator(controllerType, setting), |
|
|
|
FindGroupName(controllerType) ?? apiDescription.GroupName, |
|
|
|
controllerType, |
|
|
|
apiDescription.GroupName, |
|
|
|
_modelOptions.IgnoredInterfaces |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
@ -6,17 +6,17 @@ namespace Volo.Abp.Http.Client.ClientProxying; |
|
|
|
|
|
|
|
public class CurrentApiVersionInfo : ICurrentApiVersionInfo, ITransientDependency |
|
|
|
{ |
|
|
|
public ApiVersionInfo ApiVersionInfo => _currentPrincipal.Value; |
|
|
|
public ApiVersionInfo ApiVersionInfo => _currentApiVersionInfo.Value; |
|
|
|
|
|
|
|
private readonly AsyncLocal<ApiVersionInfo> _currentPrincipal = new AsyncLocal<ApiVersionInfo>(); |
|
|
|
private readonly AsyncLocal<ApiVersionInfo> _currentApiVersionInfo = new AsyncLocal<ApiVersionInfo>(); |
|
|
|
|
|
|
|
public virtual IDisposable Change(ApiVersionInfo apiVersionInfo) |
|
|
|
{ |
|
|
|
var parent = ApiVersionInfo; |
|
|
|
_currentPrincipal.Value = apiVersionInfo; |
|
|
|
_currentApiVersionInfo.Value = apiVersionInfo; |
|
|
|
return new DisposeAction(() => |
|
|
|
{ |
|
|
|
_currentPrincipal.Value = parent; |
|
|
|
_currentApiVersionInfo.Value = parent; |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@ -49,9 +49,10 @@ public class ModuleApiDescriptionModel |
|
|
|
return Controllers[controller.Type] = controller; |
|
|
|
} |
|
|
|
|
|
|
|
public ControllerApiDescriptionModel GetOrAddController(string name, string groupName, Type type, [CanBeNull] HashSet<Type> ignoredInterfaces = null) |
|
|
|
public ControllerApiDescriptionModel GetOrAddController(string name, string groupName, Type type, [CanBeNull]string apiVersion, [CanBeNull] HashSet<Type> ignoredInterfaces = null) |
|
|
|
{ |
|
|
|
return Controllers.GetOrAdd(type.FullName, () => ControllerApiDescriptionModel.Create(name, groupName, type, ignoredInterfaces)); |
|
|
|
var key = apiVersion.IsNullOrWhiteSpace() ? type.FullName : $"{apiVersion + "."}{type.FullName}"; |
|
|
|
return Controllers.GetOrAdd(key, () => ControllerApiDescriptionModel.Create(name, groupName, type, ignoredInterfaces)); |
|
|
|
} |
|
|
|
|
|
|
|
public ModuleApiDescriptionModel CreateSubModel(string[] controllers, string[] actions) |
|
|
|
|