/// <summary> /// Azures the document database. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="endpointUri">The endpoint URI.</param> /// <param name="authorizationKey">The authorization key.</param> /// <param name="databaseName">Name of the database.</param> /// <param name="collectionName">Name of the collection.</param> /// <param name="connectionProtocol">The connection protocol.</param> /// <param name="jsonSettings">The json settings.</param> /// <returns>SettingsConfiguration.</returns> /// <exception cref="System.ArgumentNullException">settingsConfig /// or /// endpointUri /// or /// authorizationKey</exception> public static SettingsConfiguration AzureDocumentDb(this SettingsReaderSinkConfiguration settingsConfig, Uri endpointUri, string authorizationKey, string databaseName = "AppSettings", string collectionName = "Config", Protocol connectionProtocol = Protocol.Https, JsonSerializerSettings jsonSettings = null) { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } if (endpointUri == null) { throw new ArgumentNullException(nameof(endpointUri)); } if (authorizationKey == null) { throw new ArgumentNullException(nameof(authorizationKey)); } if (string.IsNullOrEmpty(databaseName)) { databaseName = "AppSettings"; } if (string.IsNullOrEmpty(collectionName)) { collectionName = "Config"; } return(settingsConfig.Sink( new AzureDocumentDbSink( endpointUri, authorizationKey, databaseName, collectionName, connectionProtocol: connectionProtocol, jsonSettings: jsonSettings))); }
/// <summary> /// Creates the Azures File Storage Configuiration object and loads the main settings form the config manager. /// Keys: /// settings:sink:AzureFileStorage:ConnectionString /// settings:sink:AzureFileStorage:ContainerName /// settings:sink:AzureFileStorage:FileName /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="appConfigSettingsMgr">The configuration settings MGR.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">configSettingsMgr</exception> public static SettingsConfiguration AzureFileStorage(this SettingsReaderSinkConfiguration settingsConfig) { return(AzureFileStorage(settingsConfig, System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureFileStorage:ConnectionString"], System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureFileStorage:ContainerName"], System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureFileStorage:FileName"] )); }
/// <summary> /// Creates the Azures the file storage Configuiration object and loads the main settings form the config manager. /// Keys: /// settings:sink:AzureFileStorage:EndPointUri /// settings:sink:AzureFileStorage:AuthorizationKey /// settings:sink:AzureFileStorage:DatabaseName /// settings:sink:AzureFileStorage:CollectionName /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="appConfigSettingsMgr">The configuration settings MGR.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">configSettingsMgr</exception> public static SettingsConfiguration AzureDocumentDb(this SettingsReaderSinkConfiguration settingsConfig) { return(AzureDocumentDb(settingsConfig, new Uri(System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureDocumentDb:EndPointUri"]), System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureDocumentDb:AuthorizationKey"], System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureDocumentDb:DatabaseName"], System.Configuration.ConfigurationManager.AppSettings["settings:sink:AzureDocumentDb:CollectionName"] )); }
/// <summary> /// Initialzies the Azure Clould config Settings Reader Sink. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <returns>SettingsConfiguration.</returns> /// <exception cref="System.ArgumentNullException">settingsConfig</exception> public static SettingsConfiguration SystemAppConfig <T>(this SettingsReaderSinkConfiguration settingsConfig) where T : class, new() { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } return(settingsConfig.Sink( new SettingsAzureClouldAppConfigSink())); }
/// <summary> /// Initialzies the System app.config Settings Reader Sink. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <returns>SettingsConfiguration.</returns> /// <exception cref="System.ArgumentNullException">settingsConfig</exception> public static SettingsConfiguration SystemAppConfig(this SettingsReaderSinkConfiguration settingsConfig) { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } return(settingsConfig.Sink( new SettingsSystemAppConfigSink())); }
/// <summary> /// Creates the ConfigBuilder Configuiration object and loads the main settings form the config manager. /// Keys: /// settings:sink:ConfigBuilder:FileName /// </summary> /// <param name="settingsConfig">The settings configuration.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">configSettingsMgr</exception> public static SettingsConfiguration ConfigBuilder(this SettingsReaderSinkConfiguration settingsConfig) { if (System.Configuration.ConfigurationManager.AppSettings.AllKeys.Contains("settings:sink:ConfigBuilder:FileName")) { return(ConfigBuilder(settingsConfig, System.Configuration.ConfigurationManager.AppSettings["settings:sink:ConfigBuilder:FileName"] )); } return(settingsConfig.Sink(new ConfigBuilderSink())); }
/// <summary> /// Creates the ConfigBuilder Configuiration object and loads the main settings form the config manager. /// </summary> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="configurationFile">Name of the file.</param> /// <param name="optional">The json settings.</param> /// <param name="fileType">Indicates the file type being used (json or xml)</param> /// <param name="reloadOnChange">Indicates if the settings should automatically reload when a file change is detected</param> /// <returns>SettingsConfiguration.</returns> /// <exception cref="System.ArgumentNullException">settingsConfig</exception> public static SettingsConfiguration ConfigBuilder(this SettingsReaderSinkConfiguration settingsConfig, string configurationFile, bool optional = false, bool reloadOnChange = false, ConfigurationFileTypes fileType = ConfigurationFileTypes.Json) { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } if (string.IsNullOrEmpty(configurationFile)) { throw new ArgumentNullException(nameof(configurationFile)); } return(settingsConfig.Sink( new ConfigBuilderSink(configurationFile, optional, reloadOnChange, fileType))); }
/// <summary> /// Initialzies the Json.NET Settings Reader Sing. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="fileName">Name of the file.</param> /// <param name="jsonSettings">The json settings.</param> /// <returns>SettingsConfiguration.</returns> /// <exception cref="System.ArgumentNullException">settingsConfig</exception> public static SettingsConfiguration JsonNet(this SettingsReaderSinkConfiguration settingsConfig, string fileName, Newtonsoft.Json.JsonSerializerSettings jsonSettings = null) { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException(nameof(fileName)); } return(settingsConfig.Sink( new SettingsJsonSink(fileName, jsonSettings))); }
public static SettingsConfiguration AzureFileStorage(this SettingsReaderSinkConfiguration settingsConfig, string connectionString, string containerName = "AppSettings", string fileName = "Settings.json") { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } if (string.IsNullOrEmpty(containerName)) { containerName = "AppSettings"; } if (string.IsNullOrEmpty(fileName)) { fileName = "Settings.json"; } return(settingsConfig.Sink( new AzureFileStorageSink( connectionString, containerName, fileName ))); }
/// <summary> /// Creates the ConfigBuilder Configuiration object and loads the main settings form the config manager. /// </summary> /// <param name="settingsConfig">The settings configuration.</param> /// <param name="configurationBuilder">the configuration builder instance to use</param> /// <returns></returns> /// <exception cref="ArgumentNullException">configSettingsMgr</exception> public static SettingsConfiguration ConfigBuilder(this SettingsReaderSinkConfiguration settingsConfig, IConfigurationBuilder configurationBuilder) { return(settingsConfig.Sink(new ConfigBuilderSink(configurationBuilder))); }
/// <summary> /// Memories the specified settings value. /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settings">The settings.</param> /// <param name="settingsValue">The settings value.</param> /// <returns>SettingsConfiguration<T>.</returns> public static SettingsConfiguration Memory <T>(this SettingsReaderSinkConfiguration settings, T settingsValue) { return(settings.Sink(new MemorySink(settingsValue))); }
/// <summary> /// Creates the JsonNet Configuiration object and loads the main settings form the config manager. /// Keys: /// settings:sink:JsonNet:FileName /// </summary> /// <typeparam name="T"></typeparam> /// <param name="settingsConfig">The settings configuration.</param> /// <returns></returns> /// <exception cref="ArgumentNullException">configSettingsMgr</exception> public static SettingsConfiguration JsonNet(this SettingsReaderSinkConfiguration settingsConfig) { return(JsonNet(settingsConfig, System.Configuration.ConfigurationManager.AppSettings["settings:sink:JsonNet:FileName"] )); }