コード例 #1
0
        /// <summary>
        /// 解析数据对象
        /// </summary>
        /// <param name="type"></param>
        /// <returns></returns>
        public Dictionary <string, object> ResolverObject(Type type)
        {
            Dictionary <string, object> dictionary = null;
            string key = CreateKey(type);

            if (!HasData(key))
            {
                dictionary = ObjectAttrResolver.ResolveObj(type);
                if (dictionary == null)
                {
                    throw new Exception("对象解析失败未找到对应的解析属性");
                }
                Add(key, dictionary);
            }

            return(dictionary);
        }
コード例 #2
0
        public Dictionary <string, object> ResolverObject(Type type)
        {
            Dictionary <string, object> dictionary;
            string key = CreateKey(type);

            if (objectDictionary.ContainsKey(key))
            {
                if (objectDictionary[key] == null)
                {
                    objectDictionary.Remove(key);
                }
            }
            dictionary = ObjectAttrResolver.ResolveObj(type);
            if (dictionary != null)
            {
                objectDictionary.Add(key, dictionary);
            }
            else
            {
                throw new Exception("对象解析失败 未找到对应的解析属性");
            }
            return(dictionary);
        }