Xafari Console Module

Xafari.BC.Console module provides the runtime for the XAF application in console mode. RunCmd.exe console utility shipped with Xafari is based on this module.

The main features of console module are listed below:

  • It supports XafariApplicationContext and AppModule.
  • It allows to implement component tests for the console application and prompt window commands
  • If necessary, the console mode can be integrated in the main app or in the XAS
  • You can easily implement custom command-line utility for the XAF application
  • Xafari  solution template for the Visual Studio contains a special project to develop custom command-line utility, you can use this project to debug console commands.

The code snippet below illustrates the technique of starting the console application:

  • c#
  • VB

static int Main(string[] args)
  using (var host = new ConsoleApplicationHost(args) { Name = "XafariSolution.Console" })
      return host.Start();
    catch (Exception e)
      return host.HandleException(e);

Private Shared Function Main(ByVal args As String()) As Integer
  Using host = New ConsoleApplicationHost(args) With {.Name = "XafariSolution.Console"}
      Return host.Start()
    Catch e As Exception
      Return host.HandleException(e)
    End Try
  End Using
End Function