mirror of
https://github.com/AlexMacocian/SystemExtensions.git
synced 2026-07-15 14:19:29 +00:00
e6a06915cd
Codestyle fixes Setup CODEOWNERS Setup dependabot
31 lines
709 B
C#
31 lines
709 B
C#
using System.Extensions;
|
|
|
|
namespace System.Configuration;
|
|
|
|
public sealed class LiveUpdateableOptionsWrapper<T> : ILiveUpdateableOptions<T>
|
|
where T : class
|
|
{
|
|
private readonly IOptionsManager configurationManager;
|
|
|
|
private T value;
|
|
|
|
public T Value
|
|
{
|
|
get
|
|
{
|
|
this.value = this.configurationManager.GetOptions<T>();
|
|
return this.value;
|
|
}
|
|
}
|
|
|
|
public LiveUpdateableOptionsWrapper(IOptionsManager configurationManager)
|
|
{
|
|
this.configurationManager = configurationManager.ThrowIfNull(nameof(configurationManager));
|
|
}
|
|
|
|
public void UpdateOption()
|
|
{
|
|
this.configurationManager.UpdateOptions<T>(this.value);
|
|
}
|
|
}
|