/// <summary> /// Initializes a new instance of the <see cref="SettingsServiceBuilder"/> class. /// </summary> public SettingsServiceBuilder() { this.appKeyPrefix = string.Empty; this.settingsPostfix = "Settings"; this.converter = new DefaultSettingConverter(); this.handler = new ThrowOnInvalidSettingHandler(); }
/// <summary> /// Initializes a new instance of the <see cref="AspNetCoreSettingsService"/> class. /// </summary> /// <param name="configuration">The configuration.</param> /// <param name="appKeyPrefix">The application key prefix.</param> /// <param name="settingsPostfix">The settings postfix.</param> /// <param name="converter">The converter.</param> /// <param name="handler">The handler.</param> public AspNetCoreSettingsService( IConfiguration configuration, string appKeyPrefix = "", string settingsPostfix = "Settings", ISettingConverter converter = null, IInvalidSettingHandler handler = null) : base(new AspNetCoreSettingsSource(configuration), appKeyPrefix, settingsPostfix, converter, handler) { }
/// <summary> /// Initializes a new instance of the <see cref="AppConfigSettingsService"/> class. /// </summary> /// <param name="settings">The settings.</param> /// <param name="appKeyPrefix">The application key prefix.</param> /// <param name="settingsPostfix">The settings postfix.</param> /// <param name="converter">The converter.</param> /// <param name="handler">The handler.</param> public AppConfigSettingsService( NameValueCollection settings, string appKeyPrefix = "", string settingsPostfix = "Settings", ISettingConverter converter = null, IInvalidSettingHandler handler = null) : base(new AppConfigSettingsSource(settings), appKeyPrefix, settingsPostfix, converter, handler) { }
/// <summary> /// Initializes a new instance of the <see cref="DefaultSettingsService"/> class. /// </summary> /// <param name="source">The source.</param> /// <param name="appKeyPrefix">The application key prefix.</param> /// <param name="settingsPostfix">The settings postfix.</param> /// <param name="converter">The converter.</param> /// <param name="handler">The handler.</param> public DefaultSettingsService( ISettingsSource source, string appKeyPrefix = "", string settingsPostfix = "Settings", ISettingConverter converter = null, IInvalidSettingHandler handler = null) { if (string.IsNullOrWhiteSpace(settingsPostfix)) { throw new ArgumentNullException(nameof(settingsPostfix)); } this.appKeyPrefix = appKeyPrefix; this.settingsPostfix = settingsPostfix; this.source = source ?? throw new ArgumentNullException(nameof(source)); this.converter = converter ?? new DefaultSettingConverter(); this.handler = handler ?? new ThrowOnInvalidSettingHandler(); }