BO4E/BO/BusinessObject.cs
/// <summary>
///     Get a list of FieldInfo objects that contain the key of a Business Object.
///     The list is sorted by the JsonPropertyAttribute.Order, assuming 0 if not specified.
/// </summary>
/// <param name="boType">Business Object type</param>
/// <returns>A list of FieldInfos to be used for accessing the key values.</returns>
Get a list of FieldInfo objects that contain the key of a Business Object.
The list is sorted by the JsonPropertyAttribute.Order, assuming 0 if not specified.
Get a list of FieldInfo objects that contain the key of a Business Object . The list is sorted by the JsonPropertyAttribute . Order assuming 0 if not specified .
public static List<PropertyInfo> GetBoKeyProps(Type boType)
        {
            if (!boType.IsSubclassOf(typeof(BusinessObject)))
                throw new ArgumentException(
                    $"Business Object keys are only defined on Business Object types but {boType} is not a Business Object.");
            return boType.GetProperties()
                .Where(p => p.GetCustomAttributes(typeof(BoKey), false).Length > 0)
                .OrderBy(ap => ap.GetCustomAttribute<JsonPropertyAttribute>()?.Order)
                .ToList();
        }
public static List < PropertyInfo > GetBoKeyProps ( Type boType ) { if ( ! boType . IsSubclassOf ( typeof ( BusinessObject ) ) ) throw new ArgumentException ( $" Business Object keys are only defined on Business Object types but  { boType }  is not a Business Object. " ) ; return boType . GetProperties ( ) . Where ( p => p . GetCustomAttributes ( typeof ( BoKey ) , false ) . Length > 0 ) . OrderBy ( ap => ap . GetCustomAttribute < JsonPropertyAttribute > ( ) ? . Order ) . ToList ( ) ; }
Get a list of FieldInfo objects that contain the key of a Business Object.
Get a list of FieldInfo objects that contain the key of a Business Object .
A list of FieldInfos to be used for accessing the key values.
A list of FieldInfos to be used for accessing the key values .
boType
Type
Business Object type
Business Object type