Is your feature request related to a specific problem? Or an existing feature?
Currently, AddResiliencePipelineContext.EnableReloads<TOptions>() only supports enabling reloads via an IOptionsMonitor<TOptions> that is resolved from DI:
RegistryContext.EnableReloads(
ServiceProvider.GetRequiredService<IOptionsMonitor<TOptions>>(),
name);
This makes it impossible to enable reloads for custom or external IOptionsMonitor<TOptions> implementations that are not registered in DI as IOptionsMonitor<TOptions>.
This limitation prevents several legitimate and advanced scenarios, such as:
- Using a custom options system not based on
Microsoft.Extensions.Options
- Wrapping another configuration source (feature flags, remote config, tenant-specific config, etc.)
- Sharing a single monitor instance across multiple pipelines without DI registration
- Avoiding DI pollution when the monitor is internal or pipeline-specific
Describe the solution you'd like
Expose an additional public overload that allows explicitly supplying an IOptionsMonitor<TOptions> instance:
public void EnableReloads<TOptions>(
IOptionsMonitor<TOptions> monitor,
string? name = null)
where TOptions : class;
This would internally forward to the existing infrastructure currently wired via RegistryContext.EnableReloads(...).
Expected behavior:
- The pipeline is rebuilt when
monitor.OnChange fires
name continues to behave the same way as in the existing overload
- No change in behavior for existing users
This overload would be purely additive and backward-compatible.
Additional context
No response
Is your feature request related to a specific problem? Or an existing feature?
Currently,
AddResiliencePipelineContext.EnableReloads<TOptions>()only supports enabling reloads via anIOptionsMonitor<TOptions>that is resolved from DI:This makes it impossible to enable reloads for custom or external
IOptionsMonitor<TOptions>implementations that are not registered in DI asIOptionsMonitor<TOptions>.This limitation prevents several legitimate and advanced scenarios, such as:
Microsoft.Extensions.OptionsDescribe the solution you'd like
Expose an additional public overload that allows explicitly supplying an
IOptionsMonitor<TOptions>instance:This would internally forward to the existing infrastructure currently wired via
RegistryContext.EnableReloads(...).Expected behavior:
monitor.OnChangefiresnamecontinues to behave the same way as in the existing overloadThis overload would be purely additive and backward-compatible.
Additional context
No response