private static void ExtractField(IMapCategory parent)
        {
            foreach (var fieldProperty in GetProperties <InfoFieldAttribute>(parent.OwnerType))
            {
                var ignore = GetAttribute <IgnoreAttribute>(fieldProperty);
                if (ignore != null)
                {
                    continue;
                }

                InfoFieldAttribute attribute = GetAttribute <InfoFieldAttribute>(fieldProperty);

                if (fieldProperty.PropertyType != typeof(string) &&
                    typeof(IEnumerable).IsAssignableFrom(fieldProperty.PropertyType))
                {
                    var mapCategory = new EnumerableMapCategory(parent, attribute.Name, fieldProperty);
                    parent.AddCategory(mapCategory);
                }
                else
                {
                    parent.AddField(new MapField(parent, attribute, fieldProperty));
                }
            }
        }
Exemplo n.º 2
0
 public MapField(IMapCategory category, InfoFieldAttribute attribute, PropertyInfo propertyInfo)
 {
     Category          = category ?? throw new ArgumentNullException(nameof(category));
     this.attribute    = attribute ?? throw new ArgumentNullException(nameof(attribute));
     this.propertyInfo = propertyInfo ?? throw new ArgumentNullException(nameof(propertyInfo));
 }