Class InMemorySettingStore
Thread-safe in-memory ISettingStore for tests — the drop-in double for the
EF-backed setting store, mirroring its contract semantics: exact-scope reads/writes,
null-value deletion, and the widened erasure-sweep semantics of
DeleteScopeAsync(SettingScope, CancellationToken) (a user scope erases the user's values across all tenants,
a tenant scope erases the tenant's values across all users, the global scope erases only
global values).
public sealed class InMemorySettingStore : ISettingStore
- Inheritance
-
InMemorySettingStore
- Implements
- Inherited Members
- Extension Methods
Methods
DeleteScopeAsync(SettingScope, CancellationToken)
Erasure sweep — the settings-plane sibling of the key store's scope erasure. Unlike the exact-scope reads/writes, the sweep widens per dimension: a user scope deletes the user's values in every tenant (and their user-global values), a tenant scope deletes the tenant's values for every user (and its tenant-global values), the global scope deletes only global values.
public Task DeleteScopeAsync(SettingScope scope, CancellationToken cancellationToken = default)
Parameters
scopeSettingScopeThe scope naming the user and/or tenant to erase.
cancellationTokenCancellationTokenToken to observe while deleting.
Returns
GetAllAsync(SettingScope, CancellationToken)
Gets every value stored in exactly this scope, keyed by setting name.
public Task<IReadOnlyDictionary<string, string>> GetAllAsync(SettingScope scope, CancellationToken cancellationToken = default)
Parameters
scopeSettingScopeThe exact scope to read.
cancellationTokenCancellationTokenToken to observe while reading.
Returns
- Task<IReadOnlyDictionary<string, string>>
The scope's values; empty when the scope holds none.
GetOrNullAsync(string, SettingScope, CancellationToken)
Gets the value stored for the name in exactly this scope, or null when none is set.
public Task<string?> GetOrNullAsync(string name, SettingScope scope, CancellationToken cancellationToken = default)
Parameters
namestringThe setting name.
scopeSettingScopeThe exact scope to read.
cancellationTokenCancellationTokenToken to observe while reading.
Returns
SetAsync(string, string?, SettingScope, CancellationToken)
Sets the value for the name in exactly this scope; null deletes the entry.
public Task SetAsync(string name, string? value, SettingScope scope, CancellationToken cancellationToken = default)
Parameters
namestringThe setting name.
valuestringThe value to store, or
nullto remove the scope's value.scopeSettingScopeThe exact scope to write.
cancellationTokenCancellationTokenToken to observe while writing.