Example #1
0
        /// <summary>
        /// Sets up configuration from a configuration source.
        /// </summary>
        /// <typeparam name="TConfigurationSection">The type of the configuration section.</typeparam>
        /// <param name="configurationName">The name of the configuration section.</param>
        /// <param name="configurationSource">The source of the configuration section.</param>
        public static void SetupConfiguration <TConfigurationSection>(string configurationName, IConfigurationSource configurationSource)
            where TConfigurationSection : DaConfigurationSection
        {
            if (string.IsNullOrEmpty(configurationName))
            {
                throw new ArgumentNullException("configurationName");
            }

            if (configurationSource == null)
            {
                throw new ArgumentNullException("configurationSource");
            }

            var settings = configurationSource.GetConfigurationSection <TConfigurationSection>(configurationName);

            _Settings.Add(configurationName, settings);
        }