Skip to content

SAIF.Presentation.ConsoleApplication operations and processes

This page is the operation catalog and cross-operation hub for this base-class library. It provides the standard lifecycle and diagnostic conventions that downstream console/batch applications build on. Each operation's detailed, step-by-step logic lives in its own page under operations/.

Operation catalog

Operation Intent Trigger Inputs Outputs Rules Tables SQL
Console application execution lifecycle Orchestrate the standard initialize/validate/run/uninitialize template-method lifecycle, extended with multi-stream logging and batch header/footer for batch applications Downstream Sub Main instantiates a clsConsoleBase/clsBatchBase subclass and calls Execute() Command-line arguments; environment variables (batch) ReturnCode / Environment.ExitCode; console output; flushed/closed log streams (batch) BR-002, BR-003, BR-005 — —
Command-line argument parsing and lookup Resolve named or positional /Name:Value/-Name:Value command-line switches Downstream code calls ParamExists, GetParamName, or GetParamValue after Initialize() Normalized argument array; requested name or index Existence result; resolved name or value string BR-002, BR-004, BR-005 — —
Exception diagnostics formatting Produce a human-readable diagnostic string for an exception, including inner exceptions Downstream error-handling code calls GetExceptionInfo(ex) ex As Exception Formatted diagnostic String — — —
Batch log and status message writing Emit status, error, or named-stream log output for batch applications Downstream batch code calls WriteStatusMsg, WriteErrorMsg, or WriteAppLogMsg Message text; optional BatchStreams target Console or file output; opened/tracked file stream BR-001, BR-006 — —

Process flow diagram

The following diagram visualizes the primary operational flow: a downstream application drives its lifecycle through this library, using argument lookup and exception/log-writing operations as supporting capabilities along the way.

flowchart TD
    Start([Sub Main calls Execute]) --> Lifecycle[Console application execution lifecycle:<br>Initialize, Validate, Run, Uninitialize]
    Lifecycle --> ArgLookup[RunAppLogic/ValidateCommandLine<br>call command-line argument<br>parsing and lookup as needed]
    Lifecycle --> LogWrite{Batch application?}
    LogWrite -->|Yes| BatchWrite[RunAppLogic calls batch log<br>and status message writing]
    Lifecycle --> ExDiag{Exception caught<br>during RunAppLogic?}
    ExDiag -->|Yes| Diag[Format exception diagnostics<br>and report via status/error writes]
    ExDiag -->|No| Done
    ArgLookup --> Done([Lifecycle proceeds to Uninitialize])
    BatchWrite --> Done
    Diag --> Done

Failure and edge-case behavior

  • When command-line validation fails, RunAppLogic() is never invoked; the application instead waits for user input before proceeding to Uninitialize() (BR-003).
  • Writing to a non-StandardFile batch log stream whose environment variable is unset or empty throws an exception rather than silently discarding the message (BR-001).
  • Repeated writes to the StandardFile batch log stream each reopen the file via a new StreamWriter rather than reusing the one from a prior write (BR-006).
  • Command-line switch and value lookups match by prefix rather than exact equality, which can resolve an unintended argument when switch names share a common prefix (BR-005).
  • See each operation's detail page under operations/ for the complete set of failure and edge-case behaviors.

Sources

  • Presentation\SAIF.Presentation.ConsoleApplication\clsConsoleBase.vb
  • Presentation\SAIF.Presentation.ConsoleApplication\clsBatchBase.vb