zeroframework/Services/Identity/ZeroFramework.IdentityServer.API/Tenants/CurrentTenantAccessor.cs
2023-12-05 17:22:48 +08:00

11 lines
399 B
C#

namespace ZeroFramework.IdentityServer.API.Tenants
{
public class CurrentTenantAccessor : ICurrentTenantAccessor
{
private readonly AsyncLocal<TenantInfo?> _currentScope = new();
public TenantInfo? Current { get => _currentScope.Value; set => _currentScope.Value = value; }
public CurrentTenantAccessor() => _currentScope = new AsyncLocal<TenantInfo?>();
}
}