You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Configuration] WritableOptions depends on IOptionsMonitor<T> although only IOptionsSnapshot<T> functionality is used #3006
Replace the dependency on IOptionsMonitor<T> with IOptionsSnapshot<T>:
Change the constructor dependency and internal field type in WritableOptions<T>
Update WritableOptions.Value to use _options.Value instead of _options.CurrentValue
Adjust the service registration in ConfigureAsWritable<T> accordingly
(currently the only registration site; VS Code navigation already points to this class)
Why is this needed
WritableOptions<T> currently depends on IOptionsMonitor<T>, although it does not provide any monitor-specific functionality such as OnChange event and neither uses them internally.
The implementation only uses functionality that is already provided by IOptionsSnapshot<T>:
.Get(name)
CurrentValue which is equivalent to IOptionsSnapshot<T>.Value
This is also reflected in the public API:
IWritableOptions<T> inherits from IOptionsSnapshot<T>, not IOptionsMonitor<T>
Reducing the dependency to IOptionsSnapshot<T> would:
better align implementation with the exposed interface
Activity