예제 #1
0
        public Dictionary <string, string> this[string sectionName]
        {
            get
            {
                string key = string.Format("ConfigurationSection_{0}", sectionName);
                Dictionary <string, string> dictionary = CacheHelper.CacheDeserialize(key) as Dictionary <string, string>;

                if (dictionary == null)
                {
                    try
                    {
                        dictionary = ConfigurationManager.GetSection(sectionName) as Dictionary <string, string>;
                        CacheHelper.CacheSerialize(key, dictionary);
                    }
                    catch
                    {
                        throw;
                    }
                }

                return(dictionary);
            }
        }
예제 #2
0
        public Hashtable this[string sectionName]
        {
            get
            {
                string    key       = string.Format("ConfigurationSection_{0}", sectionName);
                Hashtable hashtable = CacheHelper.CacheDeserialize(key, typeof(Hashtable), false) as Hashtable;

                if (hashtable == null)
                {
                    try
                    {
                        hashtable = ConfigurationSettings.GetConfig(sectionName) as Hashtable;
                        CacheHelper.CacheSerialize(key, hashtable, false);
                    }
                    catch (ConfigurationException e)
                    {
                        throw e;
                    }
                }

                return(hashtable);
            }
        }