Interface IConfigurationRegistry
Contract for a registry that manages a collection of ScyllaConfiguration assets associated with a single owner (typically a module or the bootstrap). Provides O(1) lookup by concrete type and maintains stable registration order for deterministic iteration during validation and application.
Namespace: Scylla.Core.Config
Assembly: ScyllaCore.dll
Syntax
public interface IConfigurationRegistry
Remarks
Typical usage patterns:
- Module configurations - A ScyllaModule populates its registry during initialization by calling Register(ScyllaConfiguration) for each configuration asset discovered via its ConfigurationSlotAttribute fields. The registry is then passed to ConfigFileManager for layered config file override application.
- Bootstrap configurations - The framework bootstrap uses a registry to manage core-level configuration assets such as ScyllaCoreConfiguration before any module initializes, ensuring they are validated and applied as part of the startup sequence.
The canonical implementation is ConfigurationRegistry, which satisfies both O(1) lookup and stable iteration order via a dual dictionary-and-list internal structure.
Properties
Count
Gets the number of configurations currently registered.
Declaration
int Count { get; }
Property Value
| Type | Description |
|---|---|
| int | A non-negative integer representing the total number of distinct configuration types
held in the registry. Returns |
Methods
ApplyAll()
Calls Apply() on each registered configuration in registration order. Use this to push all configuration values into their respective runtime systems after overrides have been resolved and validation has passed.
Declaration
void ApplyAll()
AreAllValid()
Determines whether all registered configurations are currently valid by calling
IsValid() on each one in registration order.
Evaluation stops as soon as a configuration returns false (short-circuit),
so not all configurations are necessarily checked when an invalid one is encountered early.
Declaration
bool AreAllValid()
Returns
| Type | Description |
|---|---|
| bool |
|
Clear()
Removes all registered configurations from the registry, resetting it to an empty state equivalent to a freshly constructed instance. Both the typed lookup table and the registration order list are cleared.
Declaration
void Clear()
Get(Type)
Retrieves the registered configuration identified by configurationType.
Declaration
ScyllaConfiguration Get(Type configurationType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | configurationType | The Type of the configuration to look up. When |
Returns
| Type | Description |
|---|---|
| ScyllaConfiguration | The registered ScyllaConfiguration instance, or |
GetAll()
Returns all registered configurations in the order they were first registered. The sequence is stable across calls: configurations are always yielded in the order that Register(ScyllaConfiguration) was first called for each type, regardless of any subsequent replacement calls.
Declaration
IEnumerable<ScyllaConfiguration> GetAll()
Returns
| Type | Description |
|---|---|
| IEnumerable<ScyllaConfiguration> | A lazily evaluated sequence of all registered ScyllaConfiguration instances in first-registration order. Returns an empty sequence if the registry is empty. |
GetAllTypes()
Returns all registered configuration types in the order they were first registered. The sequence mirrors the registration order guarantee of GetAll() and can be used when only the type is needed without fetching the configuration instance.
Declaration
IEnumerable<Type> GetAllTypes()
Returns
| Type | Description |
|---|---|
| IEnumerable<Type> | A lazily evaluated sequence of all registered Type objects in first-registration order. Returns an empty sequence if the registry is empty. |
Get<T>()
Retrieves the registered configuration of type T.
Declaration
T Get<T>() where T : ScyllaConfiguration
Returns
| Type | Description |
|---|---|
| T | The registered configuration cast to |
Type Parameters
| Name | Description |
|---|---|
| T | The concrete ScyllaConfiguration subtype to look up. The lookup is performed by exact type match; base class types do not match derived registrations. |
Has(Type)
Determines whether a configuration of the specified type is currently registered.
Declaration
bool Has(Type configurationType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | configurationType | The Type to check for. When |
Returns
| Type | Description |
|---|---|
| bool |
|
Has<T>()
Determines whether a configuration of type T is currently registered.
Declaration
bool Has<T>() where T : ScyllaConfiguration
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| T | The concrete configuration type to check for. |
Register(ScyllaConfiguration)
Registers a configuration with the registry. The configuration is keyed by its concrete runtime type, so each distinct subclass of ScyllaConfiguration occupies exactly one slot. If a configuration of the same concrete type is already registered, the existing entry is replaced by the new instance while the slot's position in the registration order is preserved.
Declaration
void Register(ScyllaConfiguration configuration)
Parameters
| Type | Name | Description |
|---|---|---|
| ScyllaConfiguration | configuration | The configuration asset to register. Must not be |
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException | Thrown when |
Unregister(Type)
Unregisters the configuration identified by configurationType from the
registry, removing both its dictionary entry and its slot in the registration order.
Declaration
bool Unregister(Type configurationType)
Parameters
| Type | Name | Description |
|---|---|---|
| Type | configurationType | The Type of the configuration to unregister. When |
Returns
| Type | Description |
|---|---|
| bool |
|
Unregister<T>()
Unregisters the configuration of type T from the registry,
removing both its dictionary entry and its slot in the registration order.
Declaration
bool Unregister<T>() where T : ScyllaConfiguration
Returns
| Type | Description |
|---|---|
| bool |
|
Type Parameters
| Name | Description |
|---|---|
| T | The concrete configuration type to unregister. |
ValidateAll()
Validates all registered configurations in registration order and returns a flat array of
all ConfigurationValidationResult entries produced by each configuration's
Validate() method. Each result's message is prefixed with
the originating configuration's ConfigurationName in the
format [ConfigurationName] original message, making it straightforward to identify
which asset produced a given warning or error when multiple configurations are registered.
Declaration
ConfigurationValidationResult[] ValidateAll()
Returns
| Type | Description |
|---|---|
| ConfigurationValidationResult[] | A non-null array of ConfigurationValidationResult containing every result from every registered configuration, in registration order. Returns an empty array if the registry is empty or all configurations produce no results. |