Each XAF application includes a particular set of modules (see Application Solution Structure). The configuration of an XAF application specifies the list of required modules, security system settings, and so on. A complex enterprise solution can have its different functions available in various forms: win application, web application, console application, windows service, etc. The configs for all forms should be identical to avoid collisions described in the introduction.
AppModule guarantees the same configuration for all use cases of the XAF application. The idea is to add a special module (AppModule) into the XAF application. In contrary to functional XAF modules, AppModule has no such elements as Data Model, Controls, functions, etc. It is only to declare and initialize the parameters of the XAF application:
- The list of required modules,
- Security system settings,
- The way to create ObjectSpaceProvider,
- Other parameters of the XAF application.
The described approach demands just that all customization from .exe project is moved to AppModule. Only the code creating the XafApplication object and launching it should remain in the .exe project.
The diagram below demonstrates an XAF application. AppModule provides all applied modules required for each use case.
It is recommended to add several AppModules to an XAF application. The best option is to provide each platform with its own AppModule and to have one more AppModule for platform agnostic modules. The image below shows a possible scheme of relations for such approach.