Skip to main content
Table of Contents

Class InMemorySettingStore

Namespace
Stratara.Testing
Assembly
Stratara.Testing.dll

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

scope SettingScope

The scope naming the user and/or tenant to erase.

cancellationToken CancellationToken

Token to observe while deleting.

Returns

Task

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

scope SettingScope

The exact scope to read.

cancellationToken CancellationToken

Token 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

name string

The setting name.

scope SettingScope

The exact scope to read.

cancellationToken CancellationToken

Token to observe while reading.

Returns

Task<string>

The stored value, or null.

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

name string

The setting name.

value string

The value to store, or null to remove the scope's value.

scope SettingScope

The exact scope to write.

cancellationToken CancellationToken

Token to observe while writing.

Returns

Task