Exemple #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);
        }
Exemple #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);
        }
Exemple #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();
        }
Exemple #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();
        }