Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Example of creating a reader class and a bridge class that both implement IMyAppSettings
public class MyAppSettingsReader : IMyAppSettings
public string ApplicationName { get; set; }
public int CountOfItems { get; set; }
public class MyAppSettingsBridge : IMyAppSettings
private readonly IOptionsSnapshot<MyAppSettingsReader> _optionsConfig;
public MyAppSettingsBridge(IOptionsSnapshot<MyAppSettingsReader> optionsConfig)
_optionsConfig = optionsConfig ?? throw new ArgumentNullException(nameof(optionsConfig));
public string ApplicationName => _optionsConfig.Value.ApplicationName;
public int CountOfItems => _optionsConfig.Value.CountOfItems;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment