Exemplo n.º 1
0
        protected override IMemberAttribute ParserMember(string typeFullName, XmlNode memberNode)
        {
            if (string.IsNullOrEmpty(typeFullName))
            {
                throw new ArgumentNullException("typeFullName");
            }

            object target = MemberCache.Get(typeFullName);

            if (null == target)
            {
                throw new Exception(string.Format("the member cache is null for {0} type.", typeFullName));
            }
            var    members = (IDictionary <string, IMemberAttribute>)target;
            object name;

            XmlFileParser.TryGetAttributeValue(memberNode, "Name", out name);
            if (null == name)
            {
                throw new Exception("there is no name in the member config item.");
            }
            IMemberAttribute member = members[name.ToString()];

            member = members[member.Name] = GenerateMember(member, memberNode);
            MemberCache.InsertOrUpdate(typeFullName, members);
            return(member);
        }
Exemplo n.º 2
0
        protected override IDictionary <string, IMemberAttribute> ParserMembers(string typeFullName,
                                                                                XmlNodeList memberNodes)
        {
            if (string.IsNullOrEmpty(typeFullName))
            {
                throw new ArgumentNullException("typeFullName");
            }
            object target = MemberCache.Get(typeFullName);

            if (null == memberNodes || 0 == memberNodes.Count)
            {
                if (null == target)
                {
                    return(null);
                }
                return((IDictionary <string, IMemberAttribute>)target);
            }

            foreach (XmlNode node in memberNodes)
            {
                ParserMember(typeFullName, node);
            }

            if (null == target)
            {
                throw new Exception("Get the members attribute is error.");
            }
            return((IDictionary <string, IMemberAttribute>)target);
        }