mirror of https://github.com/abpframework/abp.git
7 changed files with 44 additions and 3 deletions
@ -0,0 +1,22 @@ |
|||||
|
using System; |
||||
|
using System.Threading; |
||||
|
using Volo.Abp.DependencyInjection; |
||||
|
|
||||
|
namespace Volo.Abp.Http.Client.ClientProxying; |
||||
|
|
||||
|
public class CurrentApiVersionInfo : ICurrentApiVersionInfo, ITransientDependency |
||||
|
{ |
||||
|
public ApiVersionInfo ApiVersionInfo => _currentPrincipal.Value; |
||||
|
|
||||
|
private readonly AsyncLocal<ApiVersionInfo> _currentPrincipal = new AsyncLocal<ApiVersionInfo>(); |
||||
|
|
||||
|
public virtual IDisposable Change(ApiVersionInfo apiVersionInfo) |
||||
|
{ |
||||
|
var parent = ApiVersionInfo; |
||||
|
_currentPrincipal.Value = apiVersionInfo; |
||||
|
return new DisposeAction(() => |
||||
|
{ |
||||
|
_currentPrincipal.Value = parent; |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
using System; |
||||
|
|
||||
|
namespace Volo.Abp.Http.Client.ClientProxying; |
||||
|
|
||||
|
public interface ICurrentApiVersionInfo |
||||
|
{ |
||||
|
ApiVersionInfo ApiVersionInfo { get; } |
||||
|
|
||||
|
IDisposable Change(ApiVersionInfo apiVersionInfo); |
||||
|
} |
||||
Loading…
Reference in new issue