/// <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="maxVersions">The maximum versions.</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 SettingsWriterSinkConfiguration settingsConfig, Uri endpointUri, string authorizationKey, string databaseName = "AppSettings", string collectionName = "Config", int maxVersions = 3, 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, maxVersions, connectionProtocol, jsonSettings))); }
/// <summary> /// Initialzies the Json.NET Settings Writer 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 SettingsWriterSinkConfiguration settingsConfig, string fileName, Newtonsoft.Json.JsonSerializerSettings jsonSettings = null) { if (settingsConfig == null) { throw new ArgumentNullException(nameof(settingsConfig)); } return(settingsConfig.Sink( new SettingsJsonSink(fileName, jsonSettings))); }
public static SettingsConfiguration AzureFileStorage(this SettingsWriterSinkConfiguration 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> /// 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 SettingsWriterSinkConfiguration settings, T settingsValue) { return(settings.Sink(new MemorySink(settingsValue))); }