Class RegistrationModeAttribute
- Namespace
- OpenSettings.Attributes
- Assembly
- OpenSettings.dll
Specifies how a single settings file (separate setting files should have their own setting or setting class) can be registered and resolved within the service. This attribute supports resolving via configuration options or as a singleton service.
The registration mode can be applied to any class that implements the ISettings interface. It defines how that class is registered within the service container, such as through general or specific configuration options.
There are four possible ways the registration mode can be determined:
- Provider value: If a registration mode is found in the provider source, it will override any other configuration or attribute.
- Attribute value: If no provider source value is found, the registration mode defined in this attribute is used.
- Configuration value in provider source: If neither the provider nor the attribute has a registration mode, the configuration value from the provider source will be applied.
- Default configuration value: If the configuration value from the provider source is missing, the default configuration value will be applied.
[AttributeUsage(AttributeTargets.Class)]
public class RegistrationModeAttribute : Attribute
- Inheritance
-
RegistrationModeAttribute
- Inherited Members
Remarks
This attribute should be applied only to concrete classes that implement the ISettings interface.
Constructors
RegistrationModeAttribute(RegistrationMode)
Initializes a new instance of the RegistrationModeAttribute class with the specified registration mode.
public RegistrationModeAttribute(RegistrationMode registrationMode)
Parameters
registrationMode
RegistrationModeThe registration mode for the class.
Properties
RegistrationMode
Gets the registration mode associated with the class.
public RegistrationMode RegistrationMode { get; }