Xafari ERP Concepts. System Design
This topic covers the agreements on the composition of the ERP-system modules and the techniques that configure certain platform-specific containers for an XAF-application.
First, all system modules should be clearly divided into several groups.
Platform-agnostic modules, these modules describe business-logic, define data model and business functions.
Platform-specific modules group determine the layout. These modules provide Property and List Editors, Controllers to manage the UI behavior. Each group is referenced in the specific application project only. The number of such groups depend on what target platforms are required for the ERP system:
- Windows Forms (Win): modules for the Windows Forms application version.
- Web Forms ASP.NET (Web): modules for the ASP.NET Web application version.
- ASP.NET MVC (Mvc): modules for the ASP.NET MVC application version.
- Mobile: modules for the Moble application version.
- Console: modules for the Console application version.
- Configuration (Cfg): modules required for the Xafari Applications Support.
- Xafari Server: modules required for the Xafari Server.
Second, add a special platform-independent AppModule module to describe the XAF-application. AppModule does not contain data model, controllers, functions, etc. This module specifies the parameters that initialize an arbitrary instance of the application, i.e. the heir of an XafApplication. These parameters include the list of required modules, authentication type, connection string, security type and settings, the way to create ObjectSpaceProvider, and so on. The AppModule configures application instances to operate properly.
A very common XAF development approach is to set the application parameters in the .exe project. Such practive greatly complicates the use of the system in some scenarios. To follow the concept of Xafari, configure the application in the AppModule and code remaining in the .exe project should only create and start the XafApplication object. This approach allows to complement the ERP system with the applications and services for different target platforms as required. This makes the system very flexible and adaptive.
Thus, the AppModule describes the ERP application over the platform-specific level. This greatly simplifies the development and maintenance of various platform-dependent applications and services that are included in the system.
The figure below shows the Galaktika application running in different environments (hosts).
AppModule is a platform independent module. Therefore, it adds to the application only platform independent modules. For the particular platform, appropriate platform-specific modules will be added automatically during application initialization, this is provided via the Application Context described below.
Xafari provides the AppModule Designer, which allows you to view and customize a number of application settings: module list, connection string, Security System type. It is very similar to the Application Designer.
Third, use ApplicationHost class in the application project, it is intended to create, initialize and start the specific instance of the XafApplication in the correct environment. Under the correct environment, it is understood that the resulting application fully supports the Xafari features. ApplicationHost is a class that corresponds to the platform host of the XAF applications. This class is a factory for XAF application, and it initializes the platform environment for the application.
The target application loads AppModule that specifies the list of the required platform-independent modules. Then, the ApplicationHost uses the ApplicationContext to determine which platform-specific modules must be added.
The image below demonstrates the scheme of loading a set of modules for a Win application host.
ApplicationHost creates a container designed for active use of standard Xafari features and approaches (see Xafari Approach to Application Development). The product, which has all described specifics is the Xafari ERP Application.
At the time of the release of x011 version, Xatari supplies a containers for the following usage scenarios:
- WinForms application
- WebForms application
- ASP.NET MVC application
- Mobile application
- Console application
- The application to administer business functions - Xafari Application Support
- Server to process messages - Xafari Server
Xafari provides the infrastructure for implementing the whole complex of the ideas and suggestions above. It contains the interfaces, base classes, VS templates, Xafari Solution Wizard, and the components designer.
To acquire best practices, refer to the following topics: