Class SettingCatalog
- Namespace
- Stratara.Abstractions.Settings
- Assembly
- Stratara.Abstractions.dll
The application's setting vocabulary — every SettingDefinition the application
knows, declared in code at startup and registered as a singleton (the settings-plane sibling
of the authorization plane's PermissionCatalog).
public sealed class SettingCatalog
- Inheritance
-
SettingCatalog
- Inherited Members
- Extension Methods
Examples
services.AddSettingCatalog(catalog =>
{
catalog.Add(new SettingDefinition("Notifications.Email.Enabled", "true"));
catalog.Add(new SettingDefinition("Ui.Theme", "system", IsInherited: false));
catalog.Add(new SettingDefinition("Smtp.Password", IsEncrypted: true));
});
Remarks
Declaration is strict: reading or writing an undeclared setting name through the framework components throws, so typos surface immediately instead of silently returning nothing. Build the catalog completely during service registration and treat it as immutable afterwards.
Properties
All
Every declared definition.
public IReadOnlyCollection<SettingDefinition> All { get; }
Property Value
Methods
Add(params SettingDefinition[])
Declares one or more settings.
public void Add(params SettingDefinition[] definitions)
Parameters
definitionsSettingDefinition[]The definitions to declare.
Exceptions
- ArgumentException
A definition's name is empty, or a name is declared twice (conflicting redefinition).
Contains(string)
Checks whether the setting name is declared.
public bool Contains(string name)
Parameters
namestringThe setting name to check.
Returns
- bool
truewhen declared.
GetOrNull(string)
Gets a declared definition, or null when the name is unknown.
public SettingDefinition? GetOrNull(string name)
Parameters
namestringThe setting name to look up.
Returns
- SettingDefinition
The definition, or
null.