private static ConditionMappingItemCollection GetMappingItemsBySubClass(RelativeAttributes attrs, MemberInfo sourceMI) { ConditionMappingItemCollection items = new ConditionMappingItemCollection(); System.Type subType = attrs.SubClassType != null ? attrs.SubClassType.Type : GetRealType(sourceMI); MemberInfo[] mis = GetTypeMembers(subType); foreach (SubConditionMappingAttribute attr in attrs.SubClassFieldMappings) { MemberInfo mi = GetMemberInfoByName(attr.SubPropertyName, mis); if (mi != null) { ConditionMappingItem item = new ConditionMappingItem(); item.PropertyName = sourceMI.Name; item.SubClassPropertyName = attr.SubPropertyName; item.MemberInfo = mi; if (attrs.SubClassType != null) { item.SubClassTypeDescription = attrs.SubClassType.TypeDescription; } FillMappingItemByAttr(item, attr); items.Add(item); } } return(items); }
private static void MergeMappingItems(ConditionMappingItemCollection dest, ConditionMappingItemCollection src) { foreach (ConditionMappingItem item in src) { dest.Add(item); } }
private static ConditionMappingItemCollection GetMappingItems(RelativeAttributes attrs, MemberInfo mi) { ConditionMappingItemCollection items = new ConditionMappingItemCollection(); ConditionMappingItem item = new ConditionMappingItem(); item.PropertyName = mi.Name; item.DataFieldName = mi.Name; if (attrs.FieldMapping != null) { FillMappingItemByAttr(item, attrs.FieldMapping); } item.MemberInfo = mi; items.Add(item); return(items); }