Business Numerators in XAS

The Xafari.BC.Numerators.Cfg module provides the functionality to configure and customize Numerators at runtime. There are two strategies for using this module:

  • Add the module to the resulting business application, then the functionality of the administration will be available among other application's functions.
  • The second way is to use a special administering tool - Xafari Application Support. This is a separate Windows application for configuring the system.

The Xafari.BC.Numerators.Cfg module extends the Navigation Items with the Numerators group; the corresponding element activates the View that displays the list of existing Numerators and its main parameters.

numerator_8

The parameters of the Numerator were described in the Using Model Editor topic, they are similar in here.

The AutoApply property requires an individual comment. In order to apply the Numerators to the object, it is required to call the Apply method (see Numerators' API, the Custom Numerator sample). If AutoApply is "true", then the service provides a guaranteed calling for the Apply method in all predefined situations. If AutoApply is "false", the service shifts the responsibility to the developers. If the developers use the Numerators in the business logic, they control the presence of the Apply method. When the user creates objects in the UI, a special controller calls the Apply method.

Other properties:

  • The Template property specifies the format of the generated string value. See Learn More. Template.
  • The KeyTemplate property specifies the template for the key value.
  • The StartValue property specifies the value which is used for the beginning Numerator's index.
  • The Step property specifies the numeration step.
  • The UseDeletedNumbers property specifies the scenario of using the Deleted Numbers functionality. See Learn More. Deleted Numbers.
  • The ThroughNumeration property specifies the flag which indicates whether or not the Numerator should apply for the objects of different types. See Learn More. Through Numeration.
  • The ApplyStrategy property specifies the strategy of applying the Numerator to the object; the available values are OnSave and AfterCreate.

The topic further describes how to add a new Numerator and assign it to the business object's property using the Model Editor. The new Numerator is intended for the Code property of the SomeObject's Domain Component; the code snippet below shows the SomeObject declaration:

  • c#
  • VB

using DevExpress.ExpressApp.DC;
[DomainComponent]
public interface SomeObject
{
  string Code { get; set; }
}

Imports DevExpress.ExpressApp.DC
<DomainComponent> _
Public Interface SomeObject
  Property Code As String
End Interface

Invoke XAS, activate the Numerators list, and create a new object as follows in the picture.

numerator_9

In the invoked Detail View, set Id, Caption, and other properties according to the image below:

numerator_10

The right side of the View displays NumeratorLinks. Add a new link there and set the same property values as in the following figure:

numerator_11

The parameters of the NumeratorLink were described in the Using Model Editor topic, they are similar in here.

  • The Id property specifies the NumeratorLink identifier.
  • The Type (ModelClass) property specifies the type of objects for which the automatic numbering is applied.
  • The Property specifies the property of the business object that requires the enumeration.
  • The ApplyStrategy property specifies the strategy of applying the Numerator to the object; the available values are OnSave and AfterCreate.
  • The Index property specifies the position used when sorting the NumeratorLink nodes.

The final configuration for the SomeObjectCodeNumerator Numerator is represented in the image below:

numerator_12

To see the result, run the WinForms or ASP.NET application and activate the Some Object List View. Create multiple objects and see that the Numerator sets the Code value automatically based on the Template and the Index.

numerator_13