Class ApqCfgOptionsMonitor<TOptions>
- Namespace
- Apq.Cfg.DependencyInjection
- Assembly
- Apq.Cfg.dll
支持配置变更自动更新的 IOptionsMonitor 实现
public sealed class ApqCfgOptionsMonitor<TOptions> : IOptionsMonitor<TOptions>, IDisposable where TOptions : class, new()
Type Parameters
TOptions配置选项类型
- Inheritance
-
ApqCfgOptionsMonitor<TOptions>
- Implements
-
IOptionsMonitor<TOptions>
- Inherited Members
Constructors
ApqCfgOptionsMonitor(ICfgRoot, string)
创建 ApqCfgOptionsMonitor 实例
public ApqCfgOptionsMonitor(ICfgRoot cfgRoot, string sectionKey)
Parameters
Properties
CurrentValue
Returns the current TOptions instance with the DefaultName.
public TOptions CurrentValue { get; }
Property Value
- TOptions
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Get(string?)
Returns a configured TOptions instance with the given name.
public TOptions Get(string? name)
Parameters
namestringThe name of the
TOptionsinstance, if a null DefaultName is used.
Returns
- TOptions
The
TOptionsinstance that matches the givenname.
GetChangeToken()
获取变更令牌
public IChangeToken GetChangeToken()
Returns
OnChange(Action<TOptions, string?>)
Registers a listener to be called whenever a named TOptions changes.
public IDisposable? OnChange(Action<TOptions, string?> listener)
Parameters
Returns
- IDisposable
An IDisposable which should be disposed to stop listening for changes.