Skip to content

SAIF.Presentation.ConsoleApplication overview

Documentation context: Packaged Component (NuGet)

SAIF.Presentation.ConsoleApplication is a presentation-tier base-class library (OutputType=Library, no entry point) that defines clsConsoleBase and clsBatchBase, the abstract ancestor classes consumed by actual SAIF console/batch applications elsewhere in the enterprise. Despite its folder location and "ConsoleApplication" name, it is not itself a runnable console batch application* — its build pipeline uses the NuGet packaging template rather than the console-app template, and it contains no Sub Main entry point or concrete subclass.

Purpose

  • Provide a reusable template-method lifecycle (Execute() → Initialize() → ValidateCommandLine() → RunAppLogic() → Uninitialize()) for command-line applications to implement by subclassing clsConsoleBase or clsBatchBase.
  • Provide command-line argument parsing, exception-diagnostics formatting, and (for batch-style apps) multi-stream file logging and batch header/footer status reporting.
  • Consumed by separate, actual console/batch application repositories that inherit from clsConsoleBase/clsBatchBase; this library itself defines the base classes rather than running as an application.

Responsibilities

  • Define the abstract lifecycle contract (RunAppLogic, ValidateCommandLine) that concrete console/batch applications must implement.
  • Parse and normalize command-line arguments (/Name:Value or -Name:Value style, case-insensitive).
  • Format exception diagnostics recursively, including special handling for the framework's clsSAIFException type.
  • Layer multi-stream, environment-variable-driven file logging and batch header/footer reporting on top of the console base lifecycle (clsBatchBase).

Key components

  • clsConsoleBase: root MustInherit ancestor for all SAIF console applications; owns the Execute() template method, ReturnCodes enum, command-line parsing helpers, and exception formatting.
  • clsBatchBase: MustInherit, inherits clsConsoleBase; adds the BatchStreams enum, multi-stream log-file registration, and batch header/footer console reporting.

Note: Statements marked with * are inferred from code behavior rather than explicit documentation or comments.

Sources

  • Presentation\SAIF.Presentation.ConsoleApplication\clsConsoleBase.vb
  • Presentation\SAIF.Presentation.ConsoleApplication\clsBatchBase.vb
  • Presentation\SAIF.Presentation.ConsoleApplication\SAIF.BOF.Presentation.ConsoleApplication.vbproj
  • Presentation\SAIF.Presentation.ConsoleApplication\Pipelines\build.yml