private void ProcessType(IMapCategory parent) { foreach (var mainProperty in GetProperties <InfoCategoryAttribute>(parent.OwnerType)) { InfoCategoryAttribute attribute = GetAttribute <InfoCategoryAttribute>(mainProperty); if (attribute.Ignore) { continue; } MapCategory mapCategory = new ChildMapCategory(parent, attribute.Name, mainProperty); mapCategory.IsCollapsed = attribute.IsCollapsed; parent.AddCategory(mapCategory); ProcessType(mapCategory); } ExtractField(parent); ExtractCollectionField(parent); }
public IMapCategory Construct(Type type, bool isPropertyName = false) { if (type == null) { throw new ArgumentNullException(nameof(type)); } InfoCategoryAttribute rootAttribute = (InfoCategoryAttribute) type.GetCustomAttributes(typeof(InfoCategoryAttribute), false).FirstOrDefault(); if (rootAttribute == null) { throw new ArgumentOutOfRangeException("T"); } MapCategory main = new MapCategory(isPropertyName, rootAttribute.Name, type); ProcessType(main); return(main); }