public MyAppSettingsBridge(IOptionsMonitor <MyAppSettings> appSettings, ISettingsDecrypt decryptor, ISettingsValidator validator) { var appSettingsUnwrapped = appSettings?.CurrentValue ?? throw new ArgumentNullException(nameof(appSettings)); if (decryptor is null) { throw new ArgumentException(nameof(decryptor)); } if (validator is null) { throw new ArgumentNullException(nameof(validator)); } if (!validator.TryValidate(appSettingsUnwrapped, out var validationException)) { throw validationException; } ApplicationName = appSettingsUnwrapped.ApplicationName; SqlConnectionSting = decryptor.Decrypt("Sql", appSettingsUnwrapped.Secrets); OracleConnectionSting = decryptor.Decrypt("Oracle", appSettingsUnwrapped.Secrets); }
public MyAppSettingsBridge(IOptionsSnapshot <MyAppSettings> appSettings, ISettingsDecrypt decryptor, ISettingsValidator validator) { _appSettings = appSettings ?? throw new ArgumentNullException(nameof(appSettings)); _decryptor = decryptor ?? throw new ArgumentException(nameof(decryptor)); if (validator == null) { throw new ArgumentNullException(nameof(validator)); } if (!validator.TryValidate(appSettings.Value, out var validationException)) { throw validationException; } }
public DbSettingsBridge(IOptionsSnapshot <DbSettings> dbSettings, ISettingsValidator validator, IDecryptor decryptor) { _dbSettings = dbSettings ?? throw new ArgumentNullException(nameof(dbSettings)); _decryptor = decryptor ?? throw new ArgumentException(nameof(decryptor)); if (validator == null) { throw new ArgumentNullException(nameof(validator)); } if (!validator.TryValidate(dbSettings.Value, out var validationException)) { throw validationException; } }