Struct SettingScope
- Namespace
- Stratara.Abstractions.Settings
- Assembly
- Stratara.Abstractions.dll
Identifies which slice of the settings plane a value belongs to: global, per tenant, per
user, or per user-in-tenant. Mirrors the shape of the security plane's
KeyScope — ids are strings so opaque slugs and
GUIDs (via Guid.ToString()) work alike.
public readonly record struct SettingScope : IEquatable<SettingScope>
- Implements
- Inherited Members
- Extension Methods
Remarks
Read/write operations address a scope exactly; only DeleteScopeAsync(SettingScope, CancellationToken) widens deliberately for erasure sweeps (see its documentation). The read facade (ISettingProvider) walks scopes from most to least specific: user-in-tenant → user → tenant → global.
Constructors
SettingScope(string?, string?)
Identifies which slice of the settings plane a value belongs to: global, per tenant, per
user, or per user-in-tenant. Mirrors the shape of the security plane's
KeyScope — ids are strings so opaque slugs and
GUIDs (via Guid.ToString()) work alike.
public SettingScope(string? TenantId = null, string? UserId = null)
Parameters
TenantIdstringThe owning tenant, or
nullfor user-global/global scopes.UserIdstringThe owning user, or
nullfor tenant/global scopes.
Remarks
Read/write operations address a scope exactly; only DeleteScopeAsync(SettingScope, CancellationToken) widens deliberately for erasure sweeps (see its documentation). The read facade (ISettingProvider) walks scopes from most to least specific: user-in-tenant → user → tenant → global.
Properties
Global
The application-wide scope (no tenant, no user).
public static SettingScope Global { get; }
Property Value
NormalizedTenantId
The canonical storage form of TenantId: the empty string when unset. Stores
key rows by this form (never NULL) so composite keys stay portable across providers
with differing NULL-uniqueness rules; owning it here keeps every store implementation and
its test double on the same convention.
public string NormalizedTenantId { get; }
Property Value
NormalizedUserId
The canonical storage form of UserId: the empty string when unset.
public string NormalizedUserId { get; }
Property Value
TenantId
The owning tenant, or null for user-global/global scopes.
public string? TenantId { get; init; }
Property Value
UserId
The owning user, or null for tenant/global scopes.
public string? UserId { get; init; }
Property Value
Methods
ForTenant(Guid)
Scope for one tenant's settings.
public static SettingScope ForTenant(Guid tenantId)
Parameters
tenantIdGuidThe owning tenant.
Returns
- SettingScope
The tenant scope.
ForUser(Guid)
Scope for one user's tenant-independent settings.
public static SettingScope ForUser(Guid userId)
Parameters
userIdGuidThe owning user.
Returns
- SettingScope
The user scope.
ForUserInTenant(Guid, Guid)
Scope for one user's settings within one tenant.
public static SettingScope ForUserInTenant(Guid tenantId, Guid userId)
Parameters
Returns
- SettingScope
The user-in-tenant scope.