-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
kind/enhancementNew feature or request.New feature or request.triage/untriagedIndicates an issue requires triaging or verification.Indicates an issue requires triaging or verification.
Description
What would you like to be changed
Replace the dependency on IOptionsMonitor<T> with IOptionsSnapshot<T>:
- Change the constructor dependency and internal field type in
WritableOptions<T> - Update
WritableOptions.Valueto use_options.Valueinstead 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)CurrentValuewhich is equivalent toIOptionsSnapshot<T>.Value
This is also reflected in the public API:
IWritableOptions<T>inherits fromIOptionsSnapshot<T>, notIOptionsMonitor<T>
Reducing the dependency to IOptionsSnapshot<T> would:
- better align implementation with the exposed interface
- avoid unnecessary higher-privilege options access
- simplify the mental model for consumers
For which platform
- All platforms
Anything else we need to know?
Metadata
Metadata
Assignees
Labels
kind/enhancementNew feature or request.New feature or request.triage/untriagedIndicates an issue requires triaging or verification.Indicates an issue requires triaging or verification.