Esempio n. 1
0
        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);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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();
        }
Esempio n. 4
0
        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();
        }