Xafari Object Formatter

Xafari.BC.Utils.XafariObjectFormatter class is intended to convert the value of a certain type to a string representation. Converting standard data types to a different formats is implemented in the .NET ObjectFormatter class. Along with the possibilities of .NET Object Formatter class, XafariObjectFormatter also provides a number of additional features useful for XAF developers. XafariObjectFormatter can be applied to a flexible configuration of the Application Model, for example, when you configure the Numerators.

To see XafariObjectFormatter in action, refer to the Formatter|Xafari Formatter Date Object section in the Feature Center demo installed with Xafari.



XafariFormatterDateObject.cs file demonstrates an examples of applying XafariObjectFormatter in code.

The features provided by XafariObjectFormatter are listed below:

Formatted Output

A number of additional formats extends the notation of standard .NET-formatters. Special Formatter service understands selected  format notation and calculates formatted value. Formatter requires you to specify the object (context), which is used as a parameter of the algorithm. For example, the {0:Document.CreationDate, yyyy} format means that for current object the creation date will be obtained and then this date will be displayed using yyyy mask.

Navigation Through the Collection Items

If the collection implements ICalculatedParameter, IDictionary, IList or IEnumerable interfaces, then you can navigate through the collection items. The interfaces are listed in order of decreasing priority.

Navigation Through the XAF Parameters Properties

You can navigate through the parameters (or constants) properties. The list of constants can be expanded as needed.

DevExpress Expressions Support

When navigating, it is possible to use Expressions instead of specifying properties. The expression string must be enclosed in double quotes.

To learn more about the XafariObjectFormatter, refer to the following documents: