Documentation Coverage Report
Current view: top level - Azure/Cqrs.Azure.ConfigurationManager - CloudConfigurationManager.cs Hit Total Coverage
Version: 4.0 Artefacts: 2 2 100.0 %
Date: 2019-11-24 03:15:41

          Line data    Source code
       1             : #if NETCOREAPP3_0
       2             : using Microsoft.Extensions.Configuration;
       3             : #endif
       4             : 
       5             : namespace Cqrs.Azure.ConfigurationManager
       6             : {
       7             :         /// <summary>
       8             :         /// Provides access to configuration settings from the Azure Portal application settings. If no value is stored there it falls back to reading 
       9             :         /// app settings of an app.config or web.config... i.e. <see cref="System.Configuration.ConfigurationManager.AppSettings"/>
      10             :         /// </summary>
      11             :         public class CloudConfigurationManager : Configuration.ConfigurationManager
      12           1 :         {
      13             : #if NETCOREAPP3_0
      14             :                 /// <summary>
      15             :                 /// Instantiate a new instance of a <see cref="CloudConfigurationManager"/>
      16             :                 /// </summary>
      17             :                 public CloudConfigurationManager(IConfiguration configuration)
      18             :                 {
      19             :                         Configuration = configuration;
      20             :                 }
      21             : 
      22             :                 /// <summary>
      23             :                 /// The <see cref="IConfiguration"/> that can be use to get configuration settings
      24             :                 /// </summary>
      25             :                 protected IConfiguration Configuration { get; private set; }
      26             : #endif
      27             : 
      28             :                 #region Implementation of IConfigurationManager
      29             : 
      30             :                 /// <summary>
      31             :                 /// Read the setting named <paramref name="key"/>.
      32             :                 /// </summary>
      33             :                 /// <param name="key">The key (or name) of the setting to read.</param>
      34           1 :                 public override string GetSetting(string key)
      35             :                 {
      36             : #if NETCOREAPP3_0
      37             :                         IConfigurationSection cqrsSection = Configuration.GetSection("Cqrs");
      38             :                         return cqrsSection[key];
      39             : #endif
      40             : #if NET472
      41             : #if DEBUG
      42             :                         return Microsoft.Azure.CloudConfigurationManager.GetSetting(key, true);
      43             : #else
      44             :                         return Microsoft.Azure.CloudConfigurationManager.GetSetting(key, false);
      45             : #endif
      46             : #endif
      47             :                 }
      48             : 
      49             : #if NETCOREAPP3_0
      50             :                 /// <summary>
      51             :                 /// Read the configuration string named <paramref name="connectionStringName"/>.
      52             :                 /// </summary>
      53             :                 /// <param name="connectionStringName">The name (or key) of the connection string to read.</param>
      54             :                 public override string GetConnectionString(string connectionStringName)
      55             :                 {
      56             :                         return Configuration.GetConnectionString(connectionStringName);
      57             :                 }
      58             : #endif
      59             : 
      60             :                 #endregion
      61             :         }
      62             : }

Generated by: LCOV version 1.13