Expressions are used to construct dynamic rules for calculating parameters in the application. Values of expressions are calculated at runtime. DevExpress XAF framework has a special mechanism for constructing formulas and expressions. The expression is a string of characters. It produces a value when parsed and evaluated. Expressions are writed in the Criteria Operators language.
Expressions with multiple operations and variables are used when developing large scale business applications. Expressions use properties of complex business objects. It can be quite difficult to create expressions manually without errors. Therefore, the regular XAF Designer is used for constructing expressions. The regular expression editor is available in the WinForms, the report designer XtraReport, and the Model Editor.
Xafari framework extends the functionality of the expression designer and also makes it available in the Web-interface. The functionality of the expression designer is implemented in the Xafari ExpressionPropertyEditor.
The ExpressionPropertyEditor allows the user to create and debug expressions at runtime. Since the expression is a string of characters, it can be represented as a string type property. Xafari ExpressionPropertyEditor displays string properties that specify expressions. It allows to create expressions using operators, business class properties, constants, extensible set of functions, and parameters. Xafari framework supplies the ExpressionPropertyEditor for the Win and ASP.NET platforms.
To see the ExpressionPropertyEditor in action, refer to the Editors|Expression Object section in the Feature Center demo installed with Xafari.
The Xafari expressions designer can be used by the system administrators and business users who configure business rules for data processing in application projects.
Accessibility in the Win and Web-versions of the XAF client and extended functionality are the key features of the Xafari expressions designer.
When creating an expression, the user can validate and debug it. These operations are available for the entire expression or for the selected part of the expression. Messages alerting the user to missing fields were added, syntax error messages were extended.
If the expression was designed for certain object type, then any object of the respective type can be used for debugging. The result of calculation of the formula for the selected object will be displayed in a special area.
The Xafari expression designer provides a hierarchical view and the possibility to select properties and collections in the metadata tree. When navigating the view, the localized display name and the programmed property name are displayed. It is possible to use properties of aggregated objects in the expression. A detailed explanatory message appears, when any item is selected.
You can extend features of the ExpressionPropertyEditor by adding the required functions, constants and parameters to the code.
To learn more about the ExpressionPropertyEditor, refer to the following documents: