In the eXpressApp Framework, some of the information used to generate a business application is specified in attributes. You can apply attributes to the Business Class (or its members) that specify validation rules, specify how the data is displayed, set relationships between classes, etc. This topic provides a list of built-in eXpressApp Framework attributes and information on where and how these attributes can be applied.
Applied to business classes and their properties. Declares a conditional appearance rule.
Applied to business class properties. Functions exactly like the PersistentAliasAttribute.
Applied to a business class. Allows you to dynamically configure a persistent alias for the target business class' property.
Applied to Boolean business class properties. Specifies captions used to display the target property's values.
Applied to a validation rule. Specifies that the rule is intended for a particular business class and does not have a corresponding validation attribute.
Specifies the mode of operation for the Collection Sources created by List Property Editors representing the CollectionSourceModeAttribute's target property.
Specifies that a Domain Component's target method will create Domain Component instances.
Specifies whether a class will have a corresponding item in the New Action's item list.
Applied to a business class' string property that stores a filter criterion for a business object collection.
Specifies the criteria according to which a List View in an Object type property's Lookup Property Editor is filtered.
Specifies the business class property that provides a criteria for filtering the target property's lookup data source.
Specifies the business class collection property that serves as the data source for the target reference business class property.
Sets default options for a class.
Applied to business classes. Sets a number of the default options for the List Views that will display objects of the target type.
Applied to reference properties of Entity Framework classes. Indicates that the property value should not be loaded when an entity object is being loaded. The property will be loaded the first time it is accessed.
Applied to business class properties. Specifies the Detail View layout options for a target property.
Specifies whether the target reference property is displayed via several Property Editors representing the referenced object's properties using a single Lookup or Object Property Editor.
Specifies the maximum number of characters that can be stored in a column, which is created to store the data of a property or field.
Applied to business classes that expose a property of the IFileData type. Activates Controllers that manage file attachments for the target business class. Specifies a property that stores a file attachment.
Applied to file data business class properties. Specifies a file type filter that appears in the Open dialog's "Files of type" box.
Specifies a property that is considered an analog of the GUID property to allow the use of more suitable values.
Applied to business class properties of the byte array type. Specifies that the target property persists an image. Attribute parameters specify settings to be used by Image Property Editors when displaying images persisted by the target property.
Specifies the name of the image that is displayed for the target class' objects or target enumeration value.
Applied to Boolean business class properties. Specifies the names of images used to display a target property's values.
Applied to Business Class properties. Indicates that the property value is updated immediately when changes occur in the current Property Editor's bound control.
Specifies the target business class property's order index that will be considered when generating layout items in a Detail View, and columns in a List View.
Applied to properties of non-persistent classes. Specifies that a target property is a key property. An example is provided in the How to: Display a Non-Persistent Object's Detail View from the Navigation topic.
Applied to a custom List Editor. Registers the List Editor in an application and specifies the object type for which a List Editor is intended.
Specifies the filters that an end-user will be able to apply to the List View that displays the target class' objects.
Specifies the mode of a property's Lookup Property Editor.
Specifies default settings that are considered when generating the Application Model node related to the target.
Specifies whether a class will have a corresponding item in the navigation control.
Applied to a business class' property. Specifies that the target property's value cannot be cloned when cloning objects using the Clone Object Module.
Applied to a business class. Specifies a business class' string property that can hold property values that were not cloned.
Applied to business classes. Specifies a caption format for the target business class' objects.
Applied to a custom Property Editor. Registers the Property Editor in the application and specifies a data type for which the Property Editor is intended.
Attributes from the Validation module:
Specify validation rules that must be satisfied by a class or property.
Specifies whether all properties of the target class can be used by the FullTextSearch Action if they satisfy the Filter Controller's FilterController.FullTextSearchTargetPropertiesMode.
Specifies whether all properties of the target class can be used by the FullTextSearch Action, if they satisfy the Filter Controller's FilterController.FullTextSearchTargetPropertiesMode.
Applied to business class properties together with the Browsable(false) attribute. Unhides a hidden property in the Member Permissions configuration UI. The target property remains hidden in other places.
Applied to business class properties. Specifies the tooltip that is displayed for the target class' objects.
Specifies whether or not the View Item that corresponds to the target property is visible in a Detail View.
Specifies whether a column that corresponds to the target property is initially visible in a List View.
Specifies whether or not a column that corresponds to the target property is initially visible in a Lookup Property Editor's List View.
Specifies whether end-users can create reports on objects of the required class.
Applied to business classes. Specifies the default property.
Specifies the display name of a business class, domain component, property, field or enumeration value.
The following table lists standard attributes from the System.ComponentModel namespace that are processed in a specific manner in XAF applications.
Specifies whether to make the target property visible in the Application Model. When false is passed as the parameter, the target property is not available in the Model Editor and do not take part in UI construction. When applied to a business class, the attribute affects all class properties (the class itself remains). This attribute is ignored when the IMemberInfo.IsVisible is calculated.
Properties are persisted, even when they are hidden using this attribute.
Indicates that the current property is the default. This means the property is:
If this attribute is not applied to a business class' property (including inherited properties), a property that contains a Name as its part is considered the default (excluding inherited properties). If there are no such properties, the property specified by the FriendlyKeyPropertyAttribute is considered the default. If the FriendlyKeyPropertyAttribute is not applied to any property, it is considered that the business class does not have the default property. In this instance, usually the Object.ToString method is used to get textual object representation.
Alternatively, you can use the XafDefaultPropertyAttribute.
Specifically, this attribute's value is assigned to the DefaultProperty attribute of Application Model's Application | BOModel | Class node.
Specifies a textual description of the target module (a descendant of the ModuleBase class). This value, passed as the parameter, is set to the ModuleBase.Description property. Additionally, it specifies a description for a custom Application Model node/property (see Model Editor).
You can use the ModuleBase.Description property instead of this attribute.
Specifies a caption for a target business class or property.
Alternatively, you can use the XafDisplayNameAttribute.
Specifically, this attribute's value is assigned to the Caption property of the Application Model's BOModel | <Class> or BOModel | <Class> | OwnMembers | <Member> node, respectively.
Specifies whether the target property represents a password or not. If it does, Property Editors and List Editors will display it using characters such as asterisks.
This attribute's value is assigned to the IModelCommonMemberViewItem.IsPassword property of Application Model's BOModel | <Class> | OwnMembers | <Member> node.
The following table lists attributes from the DevExpress.Xpo namespace specifically used by XAF. The remaining built-in XPO attributes are processed only by XPO.
Indicates that a property or field references other aggregated persistent objects. When this attribute is applied to a collection property, it must be accompanied by the AssociationAttribute.
In XAF, objects from aggregated collections are retrieved by the XPNestedObjectSpace (see BaseObjectSpace). If an aggregated collection represents a part of the One-To-Many relationship, the Link and Unlink Actions are not available, but the New Action is added to populate the collection.
Aggregated objects are meant to be created and managed only in the context of a master object, since they are considered a part of it. So, when XAF generates the default Detail View for an aggregated child object, a Property Editor corresponding to the associated master object is not included in the layout. To override this behavior, first, invoke the Model Editor for the required Views | Detail View node's Items child node. Add a PropertyEditor child node using the context menu for the property that represents the owning class. Second, add the newly declared Property Editor to the Detail View's layout (see View Items Layout Customization).
For details on how to set relationships with aggregated collections, refer to Relationships Between Persistent Objects in Code and UI.
Indicates that a property or a field is a key. Key properties (fields) can be read-only in XAF applications.
Key property values are used to correctly identify and distinguish between different instances of a business class. Usually, key properties are read-only and auto-generated.
Specifies whether to make the target business class or member visible in the Application Model or not. If you pass false as the attribute's parameter, you will not see the target class/member in the Model Editor or in the UI.
Properties are persisted, even when they are hidden using this attribute.
Specifies a caption for the target enumeration value.
Specifically, this attribute's value is assigned to the IModelLocalizationItem.Value property of Application Model's Localization | Enums | Enum | EnumerationValue node.
Specifies the maximum number of characters that can be stored in a column created to store the data of the target string type property. If this attribute is not applied, a string property can be set to a value consisting of a maximum of 100 characters.
Note that this attribute only specifies the database column size. The attribute does not prevent users from entering more than the specified number of characters using Property Editors. For instance, suppose you have a string property decorated with the Size attribute that specifies that the corresponding database column's size must be 10. If a custom Property Editor used to visualize the property allows users to enter more characters, it is perfectly valid for them to do so. In this instance, a SQL exception will be raised when trying to save an object. To ensure that users will not be able to enter and save more than a fixed maximum number of characters, use the Validation Module. For example, you can decorate a business class with RuleCriteriaAttribute, and use the Len function operator to enforce the maximum length for a string property.
In XAF, the value passed as the attribute's parameter is set as a maximum length for ASPxStringPropertyEditor and Windows Forms RichTextPropertyEditor.
In fact, this attribute can be applied to any property type. This will influence the visibility of the corresponding List View column. If the VisibleInListViewAttribute and DelayedAttribute are not applied to a target property and the SizeAttribute's parameter passes a value that is more than 255 (e.g., SizeAttribute.Unlimited), the corresponding column is set invisible by default.
This attribute's value is assigned to the IModelMember.Size property of the Application Model's BOModel | <Class> | OwnMembers | <Member> node.