/// <summary>
        /// Gets the a <see cref="ConfigurationSectionInfo"/> for the configuration sources.
        /// </summary>
        /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
        /// <returns>A <see cref="ConfigurationSectionInfo"/> for the configuration for the configuration sources.</returns>
        protected override ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider)
        {
            ConfigurationNode rootNode = ServiceHelper.GetCurrentRootNode(serviceProvider);
            ConfigurationSourceSectionNode node = null;
            if (null != rootNode) node = (ConfigurationSourceSectionNode)rootNode.Hierarchy.FindNodeByType(rootNode, typeof(ConfigurationSourceSectionNode));
            ConfigurationSourceSection sourcesSection = null;
            if (node == null)
            {
                sourcesSection = null;
            }
            else
            {

                ConfigurationSourceSectionBuilder builder = new ConfigurationSourceSectionBuilder(node);
                sourcesSection = builder.Build(); ;
            }
            return new ConfigurationSectionInfo(node, sourcesSection, ConfigurationSourceSection.SectionName);
        }
Пример #2
0
        /// <summary>
        /// Gets the a <see cref="ConfigurationSectionInfo"/> for the configuration sources.
        /// </summary>
        /// <param name="serviceProvider">The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</param>
        /// <returns>A <see cref="ConfigurationSectionInfo"/> for the configuration for the configuration sources.</returns>
        protected override ConfigurationSectionInfo GetConfigurationSectionInfo(IServiceProvider serviceProvider)
        {
            ConfigurationNode rootNode          = ServiceHelper.GetCurrentRootNode(serviceProvider);
            ConfigurationSourceSectionNode node = null;

            if (null != rootNode)
            {
                node = (ConfigurationSourceSectionNode)rootNode.Hierarchy.FindNodeByType(rootNode, typeof(ConfigurationSourceSectionNode));
            }
            ConfigurationSourceSection sourcesSection = null;

            if (node == null)
            {
                sourcesSection = null;
            }
            else
            {
                ConfigurationSourceSectionBuilder builder = new ConfigurationSourceSectionBuilder(node);
                sourcesSection = builder.Build();;
            }
            return(new ConfigurationSectionInfo(node, sourcesSection, ConfigurationSourceSection.SectionName));
        }