Skip to main content
Table of Contents

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

TenantId string

The owning tenant, or null for user-global/global scopes.

UserId string

The owning user, or null for 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

SettingScope

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

string

NormalizedUserId

The canonical storage form of UserId: the empty string when unset.

public string NormalizedUserId { get; }

Property Value

string

TenantId

The owning tenant, or null for user-global/global scopes.

public string? TenantId { get; init; }

Property Value

string

UserId

The owning user, or null for tenant/global scopes.

public string? UserId { get; init; }

Property Value

string

Methods

ForTenant(Guid)

Scope for one tenant's settings.

public static SettingScope ForTenant(Guid tenantId)

Parameters

tenantId Guid

The owning tenant.

Returns

SettingScope

The tenant scope.

ForUser(Guid)

Scope for one user's tenant-independent settings.

public static SettingScope ForUser(Guid userId)

Parameters

userId Guid

The 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

tenantId Guid

The owning tenant.

userId Guid

The owning user.

Returns

SettingScope

The user-in-tenant scope.