Явные реализации интерфейсов в проде
TenantContext, LocalTelegramGateway, DefaultPasswordHasher и WTelegramSessionClient переведены на явные реализации; типы в тестах приведены к ITenantContext.
This commit is contained in:
@@ -3,22 +3,17 @@ using Deal.SharedKernel.Tenants.Models;
|
||||
|
||||
namespace Deal.Infrastructure.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Контекст тенанта на AsyncLocal
|
||||
/// </summary>
|
||||
public sealed class TenantContext : ITenantContext
|
||||
{
|
||||
private static readonly AsyncLocal<TenantId?> Current = new();
|
||||
|
||||
public TenantId? TenantId => Current.Value;
|
||||
TenantId? ITenantContext.TenantId => Current.Value;
|
||||
|
||||
public bool HasTenant => Current.Value is not null;
|
||||
bool ITenantContext.HasTenant => Current.Value is not null;
|
||||
|
||||
public string? SchemaName => Current.Value?.SchemaName;
|
||||
string? ITenantContext.SchemaName => Current.Value?.SchemaName;
|
||||
|
||||
/// <inheritdoc />
|
||||
void ITenantContext.SetTenant(TenantId tenantId) => Current.Value = tenantId;
|
||||
|
||||
/// <inheritdoc />
|
||||
void ITenantContext.Reset() => Current.Value = null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user