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 XmlObjectMappingItemCollection GetMappingItems(RelativeAttributes attrs, MemberInfo mi) { XmlObjectMappingItemCollection items = new XmlObjectMappingItemCollection(); XmlObjectMappingItem item = new XmlObjectMappingItem(attrs.FieldMapping); item.PropertyName = mi.Name; if (string.IsNullOrEmpty(item.NodeName)) { item.NodeName = mi.Name; } item.MemberInfo = mi; items.Add(item); return(items); }