/// <summary>
        /// Gets provider configuration from an xml configuration file.
        /// </summary>
        /// <returns>The provider configuration.</returns>
        protected override IProviderConfig GetProviderConfig()
        {
            if (_configSection == null)
            {
                throw new ConfigurationErrorsException(
                    string.Format("Config section {0} not defined.", SectionName));
            }

            var providerDescriptors = new List<IProviderDescriptor>();

            Data.ProviderSettings generalSettings = null;
            Dictionary<string, string> gs = null;

            // set general settings
            foreach (ProviderSettingElement setting in _configSection.Settings)
            {
                if (gs == null)
                    gs = new Dictionary<string, string>();

                gs.Add(setting.Key, setting.Value);
            }

            if (gs != null)
            {
                string dataParserType = string.Empty;
                if (!string.IsNullOrEmpty(_configSection.Settings.DataParserType))
                {
                    dataParserType = GetDataParserType(_configSection,
                        _configSection.Settings.DataParserType);
                }

                generalSettings = new Data.ProviderSettings(gs, dataParserType);
            }

            foreach (ProviderElement providerElement in _configSection.Providers)
            {
                if (!providerElement.IsEnabled) continue;

                // get provider type
                Type providerType = GetProviderType(_configSection, providerElement);
                if (!typeof(IProvider).IsAssignableFrom(providerType))
                {
                    throw new ConfigurationErrorsException(
                        string.Format("Type '{0}' doesn't implement 'IProvider'.", providerType));
                }

                // set custom settings
                Dictionary<string, string> ps = null;
                foreach (ProviderSettingElement setting in providerElement.Settings)
                {
                    if (ps == null)
                        ps = new Dictionary<string, string>();

                    ps.Add(setting.Key, setting.Value);
                }

                // get complex data parser type
                Data.ProviderSettings providerSetting = null;
                if (ps != null)
                {
                    string dataParserType = string.Empty;
                    if (!string.IsNullOrEmpty(providerElement.Settings.DataParserType))
                    {
                        dataParserType = GetDataParserType(_configSection,
                            providerElement.Settings.DataParserType);
                    }

                    providerSetting = new Data.ProviderSettings(ps, dataParserType);
                }

                providerDescriptors.Add(
                    new ProviderDescriptor(
                            providerElement.Name,
                            providerElement.Group,
                            providerType,
                            providerSetting,
                            providerElement.IsEnabled)
                        );
            }

            return new ProviderConfig(providerDescriptors, generalSettings);
        }
        /// <summary>
        /// Gets provider configuration from an xml configuration file.
        /// </summary>
        /// <returns>The provider configuration.</returns>
        protected override IProviderConfig GetProviderConfig()
        {
            if (_configSection == null)
            {
                throw new ConfigurationErrorsException(
                          string.Format("Config section {0} not defined.", SectionName));
            }

            var providerDescriptors = new List <IProviderDescriptor>();

            Data.ProviderSettings       generalSettings = null;
            Dictionary <string, string> gs = null;

            // set general settings
            foreach (ProviderSettingElement setting in _configSection.Settings)
            {
                if (gs == null)
                {
                    gs = new Dictionary <string, string>();
                }

                gs.Add(setting.Key, setting.Value);
            }

            if (gs != null)
            {
                string dataParserType = string.Empty;
                if (!string.IsNullOrEmpty(_configSection.Settings.DataParserType))
                {
                    dataParserType = GetDataParserType(_configSection,
                                                       _configSection.Settings.DataParserType);
                }

                generalSettings = new Data.ProviderSettings(gs, dataParserType);
            }

            foreach (ProviderElement providerElement in _configSection.Providers)
            {
                if (!providerElement.IsEnabled)
                {
                    continue;
                }

                // get provider type
                Type providerType = GetProviderType(_configSection, providerElement);
                if (!typeof(IProvider).IsAssignableFrom(providerType))
                {
                    throw new ConfigurationErrorsException(
                              string.Format("Type '{0}' doesn't implement 'IProvider'.", providerType));
                }

                // set custom settings
                Dictionary <string, string> ps = null;
                foreach (ProviderSettingElement setting in providerElement.Settings)
                {
                    if (ps == null)
                    {
                        ps = new Dictionary <string, string>();
                    }

                    ps.Add(setting.Key, setting.Value);
                }

                // get complex data parser type
                Data.ProviderSettings providerSetting = null;
                if (ps != null)
                {
                    string dataParserType = string.Empty;
                    if (!string.IsNullOrEmpty(providerElement.Settings.DataParserType))
                    {
                        dataParserType = GetDataParserType(_configSection,
                                                           providerElement.Settings.DataParserType);
                    }

                    providerSetting = new Data.ProviderSettings(ps, dataParserType);
                }

                providerDescriptors.Add(
                    new ProviderDescriptor(
                        providerElement.Name,
                        providerElement.Group,
                        providerType,
                        providerSetting,
                        providerElement.IsEnabled)
                    );
            }

            return(new ProviderConfig(providerDescriptors, generalSettings));
        }