private void LoadConfig() { string configSection = defaultConfigSectionName; try { object[] eAppConfigAttributes = typeof(EAppConfigurationSection).GetCustomAttributes(false); if (eAppConfigAttributes.Any(p => p.GetType().Equals(typeof(XmlRootAttribute)))) { XmlRootAttribute xmlRootAttribute = (XmlRootAttribute) eAppConfigAttributes.SingleOrDefault(p => p.GetType().Equals(typeof(XmlRootAttribute))); if (!string.IsNullOrEmpty(xmlRootAttribute.ElementName) && !string.IsNullOrWhiteSpace(xmlRootAttribute.ElementName)) { configSection = xmlRootAttribute.ElementName; } } } catch // If any exception occurs, suppress the exception to uuse the default config section. { } this.configurationSection = (EAppConfigurationSection)ConfigurationManager.GetSection(defaultConfigSectionName); }
public RegularConfigSource() { this.appConfigurationSection = new EAppConfigurationSection(); this.appConfigurationSection.Application = new CurrentApplicationElement(); this.appConfigurationSection.ObjectContainer = new CurrentObjectContainerElement(); this.appConfigurationSection.Logger = new CurrentLoggerElement(); this.appConfigurationSection.AppPlugins = new AppPluginElementCollection(); }