Table of Contents

Interface IOptionsRegistration<TOptions>

Namespace
Acuit.Pinpoint.Workstation.Configuration
Assembly
Acuit.Pinpoint.Workstation.Interfaces.dll

An options registration.

public interface IOptionsRegistration<TOptions> where TOptions : class

Type Parameters

TOptions

The options instance type.

Extension Methods

Properties

Name

Gets the name optionally used to register the options, or null if none was specified.

string Name { get; }

Property Value

string

Value

Gets the current options value.

TOptions Value { get; }

Property Value

TOptions

Remarks

This will never be null. Before options have been loaded, or when there is an error binding the configuration setting values to the TOptions object, this will be set to a default set of options (i.e., an instance constructed via IActivatorService).

These options may be invalid (i.e., they fail data annotations validation). Implementations or clients can validate options via TryValidateObject(object, ICollection<ValidationResult>) if desired.

Methods

RegisterOptionsWatcherAsync(Func<Task>, OptionsWatcherOptions, int)

Registers an options watcher.

Task<IDisposable> RegisterOptionsWatcherAsync(Func<Task> callback, OptionsWatcherOptions options = OptionsWatcherOptions.None, int priority = 0)

Parameters

callback Func<Task>

The asynchronous callback.

options OptionsWatcherOptions

Options for the options watcher registration.

priority int

The watcher priority. Higher values indicate higher priority.

Returns

Task<IDisposable>

A task that represents the asynchronous operation. The value of its Result property contains a IDisposable that can be used to unregister the watcher.

Remarks

Registered watchers will be called in order of descending priority, and then in the order they were registered. Callbacks will always be invoked from the main application dispatcher thread.

See OptionsWatcherOptions for descriptions of how options affects the behavior of this method.

Exceptions

ArgumentNullException

callback is null.