Custom Attributes

Custom attributes provide a way of associating business-level metadata with schemas, classes, properties and relationships. One of the custom attributes commonly applied to classes is an instance label. An instance label specifies the text to be output for instances of a class in the Items Browser and other GUI. The instance label defined for the Employee class below specifies that the value of the FullName property is to be output.

MDL_Programmer's_Guide-31-2-2j.jpg

One of the custom attributes commonly applied to properties is a calcutated expression whose resultant value is assigned to the property. Often times, the expressions reference properties of the instance or a related instance. For the case below, the value to be assigned to the FullName property is defined as a concatenation of the values assigned to LastName and FirstName properties, separated by a space.

MDL_Programmer's_Guide-31-2-2k.jpg

There are a number of other pre-defined custom attributes that are available, some of which are shown below.

MDL_Programmer's_Guide-31-2-2l.jpg

Additionally, users can create and assign their own custom attributes. This is accomplished by first creating a specialized custom attribute class. An example of a user-defined custom attribute is shown below.

MDL_Programmer's_Guide-31-2-2m.jpg

Notice IsCustomAttributeClass is set to indicate that the class defines a custom attribute. As shown below, a custom attribute can have multiple properties associated with them.

MDL_Programmer's_Guide-31-2-2n.jpg

Copyright © 2017 Bentley Systems, Incorporated. All rights reserved.