private static XmlObjectMappingItemCollection GetMappingItemsBySubClass(RelativeAttributes attrs, MemberInfo sourceMI) { XmlObjectMappingItemCollection items = new XmlObjectMappingItemCollection(); System.Type subType = attrs.SubClassType != null ? attrs.SubClassType.Type : GetRealType(sourceMI); MemberInfo[] mis = GetTypeMembers(subType); foreach (XmlObjectSubClassMappingAttribute attr in attrs.SubClassFieldMappings) { MemberInfo mi = GetMemberInfoByName(attr.SubPropertyName, mis); if (mi != null) { if (items.Contains(attr.NodeName) == false) { XmlObjectMappingItem item = new XmlObjectMappingItem(attr); item.PropertyName = sourceMI.Name; item.SubClassPropertyName = attr.SubPropertyName; item.MemberInfo = mi; if (attrs.SubClassType != null) { item.SubClassTypeDescription = attrs.SubClassType.TypeDescription; } items.Add(item); } } } return(items); }
private static void MergeMappingItems(XmlObjectMappingItemCollection dest, XmlObjectMappingItemCollection src) { foreach (XmlObjectMappingItem item in src) { if (dest.Contains(item.NodeName) == false) { dest.Add(item); } } }