Application settings | Xafari Framework

Application settings

In the process of an application development, it can be necessary to provide a user with the right to configure some global parameters of the application in the runtime mode. Besides their values should be easily accessible in the code while implementing business logic.

Examples:

  • Bonus calculation factor
  • Time of keeping the supplies information before moving it to the archive
  • Default value to be used when creating a new persistent object
  • Etc.

The Xafari BC Settings module provides a ready-to-use solution to manage XAF application settings. Its features are:

  • A setting is a global storable variable.
  • Settings' values are stored in the server's database.
  • The value of a setting can be defined in an application (specific forms are used for this, oriented for a user and an administrator).
  • The value of a setting can be changed both globally for all users of the system and for a certain user o role elaboration.


To create a setting of a certain type, developer should use base classes and interfaces introduced by the Xafari BC Settings module. It's possible to create settings both for persistent and usual .NET types. For the most common .NET types, the Xafari BC Settings module provides ready tools. A user interface for setttings' editing is generated automatically. A number of settings can be divided into groups for easier usage. The inheritors of the Settings Accessor class provide access to the values of all the settings in any part of the application code.

A setting can have a number of values stored in different setting layers. Setting layers are hierarchical: if a setting value is not configured for the layer, the parent layer settings are used. Each layer is based on a declared type of the object. Hierarchy of layers is subjected to the connections between these object types. A system administrator has access to all settings layers.

The figure below demonstrates the hierarchy of settings layers based on the Department and User types. The Department and User entities are associated by means of one-to-many relational ratio.