Console Application

Сonsole application is the simplest way to perform data processing. Enterprise systems operate with a large amounts of data, and there are tasks which require significant computational resources and at the same time it almost does not need interaction with the end user. It is very advantageous to run such an operation via the command-prompt interface. This approach offers many benefits. This saves resources, because it does not need Views, Controllers, Editors, thus, memory is freed from platform-dependent modules. It is possible to run functions on a schedule, to specify the parameters in the files, to combine commands using batch file. The process takes place, and the business users are working in a regular mode.

This chapter considers the console application in the context of XAF-development, therefore there are a number of requirements the described technology must satisfy. These allegations relate both to the architecture, runtime, deployment and coding rules. The console application should be naturally integrated into the overall paradigm of the XAF development.

A typical XAF solution includes two startup projects for desktop and web based on the same business logic, and each of them provides a specific application's visual representation. There is a very important and valuable idea represented in the XAF concepts, the idea to separate business logic and business model from the application's platform. Following this idea, Xafari implemented a new scenario of interaction between the XAF application and external environment via the execution a special commands using the console utility.

To see the console utility in action refer to the Xafari Northwind demo. Xafari.Northwind.Commands project contains custom DemoCommand and RunDemo.bat file for starting with the specified parameters.


Console utility RunCmd.exe is installed with Xafari, by default, it is located in the c:\Program Files (x86)\Galaktika\Xafari Framework vXX.X.XXXX\Tools\RunCmd\ folder. This tool starts XafApplication descendant in command prompt, loads defined modules, authenticates etc.

It is important to correctly configure the RunCmd utility to the needs of specific application. Configuration options are specified in a standard RunCmd.exe.config configuration file. Authentication mechanisms defined for RunCmd, must comply with the authentication mechanism of the main application, it is because the commands interact with the application database. The ideal way to specify parameters for a console application is to use AppModule.

Xafari provides a basic set of service commands, custom command is intended to perform specific operation. Xafari uses custom commands to import/export data, to start Business Operation, to purge database, these commands are implemented in the respective modules (see Xafari Commands topic).

Set of custom commands is extensible. To add a new command to the module, you must implement a special interfaces. The development of custom commands is supported by the base classes and Xafari Templates for Visual Studio. It is also possible to include the console application project in your solution and modify it in accordance with individual requirements (see Xafari ERP Solution Wizard).


Console Application technology is an integral part of the Xafari ERP Concept.

To learn more about the Xafari Console Application technology, refer to the following topics:

How to