Delen via


SettingCategory.GenerateObserverClass Property

Definition

Gets a value indicating whether to generate an observer class for this setting category.

public bool GenerateObserverClass { get; init; }
member this.GenerateObserverClass : bool with get, set
Public Property GenerateObserverClass As Boolean

Property Value

Remarks

The observer class can be used to retrieve the current value of all settings in the category. The observer will be automatically updated with the latest values of the settings in the category and will raise events when the values change.

The observer class will be generated under a child namespace of the current namespace named Settings and will have the same name as this SettingCategory property plus the Observer suffix.

All generated observers can be added to the service collection by calling the AddSettingsObservers extension method in the InitializeServices method of the extension class. For example:

protected override void InitializeServices(IServiceCollection serviceCollection)
{
    serviceCollection.AddSettingsObservers();
    base.InitializeServices(serviceCollection);
}

Applies to