BO4E/BoMapper.cs
/// <summary>
///     Get those fields of a business object that do have attributes/annotations.
///     The result is ordered by the JsonProperty->Order value (assuming 0 if null).
/// </summary>
/// <param name="boName">name of the business object in title case
///     <example>Messlokation</example>
/// </param>
/// <param name="attributeType">type of the attribute/annotation you're interested in
///     <example>typeof(DataCategoryAttribute)</example>
/// </param>
/// <returns>Array of FieldInfos</returns>
Get those fields of a business object that do have attributes/annotations.
The result is ordered by the JsonProperty->Order value (assuming 0 if null).
Get those fields of a business object that do have attributes / annotations . The result is ordered by the JsonProperty - > Order value ( assuming 0 if null ) .
[Obsolete("Fields are only private version 1.1", true)]
        public static FieldInfo[] GetAnnotatedFields(string boName, Type attributeType)
        {
            return Assembly.GetExecutingAssembly().GetTypes()
                .Where(t => t.Name == boName ||
                            string.Equals(t.Name, boName, StringComparison.CurrentCultureIgnoreCase))
                .SelectMany(t => t.GetFields()) 
                .Where(f => f.GetCustomAttributes(attributeType, false).Length > 0)
                .OrderBy(af => af.GetCustomAttribute<JsonPropertyAttribute>()?.Order)
                .ToArray();
        }
[ Obsolete ( " " , true ) ] public static FieldInfo [ ] GetAnnotatedFields ( string boName , Type attributeType ) { return Assembly . GetExecutingAssembly ( ) . GetTypes ( ) . Where ( t => t . Name == boName || string . Equals ( t . Name , boName , StringComparison . CurrentCultureIgnoreCase ) ) . SelectMany ( t => t . GetFields ( ) ) . Where ( f => f . GetCustomAttributes ( attributeType , false ) . Length > 0 ) . OrderBy ( af => af . GetCustomAttribute < JsonPropertyAttribute > ( ) ? . Order ) . ToArray ( ) ; }
Get those fields of a business object that do have attributes/annotations.
Get those fields of a business object that do have attributes / annotations .
// by type name
Array of FieldInfos
Array of FieldInfos
boName
string
name of the business object in title case
Messlokation
name of the business object in title case Messlokation
attributeType
Type
type of the attribute/annotation you're interested in
typeof(DataCategoryAttribute)
type of the attribute / annotation you ' re interested in typeof ( DataCategoryAttribute )