---
title: SAIF.Presentation.ConsoleApplication operations and processes
summary: Business and technical operations supported by this library.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-30
library: SAIF.Presentation.ConsoleApplication
reference_type: package
---

# 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](operations/console-application-lifecycle.md) | 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](business-rules.md#br-002-case-insensitive-command-line-switch-matching), [BR-003](business-rules.md#br-003-command-line-validation-gates-application-logic), [BR-005](business-rules.md#br-005-command-line-parameter-names-match-by-prefix-not-exact-equality) | — | — |
| [Command-line argument parsing and lookup](operations/command-line-argument-parsing.md) | 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](business-rules.md#br-002-case-insensitive-command-line-switch-matching), [BR-004](business-rules.md#br-004-colon-in-a-file-path-value-is-not-treated-as-a-namevalue-separator), [BR-005](business-rules.md#br-005-command-line-parameter-names-match-by-prefix-not-exact-equality) | — | — |
| [Exception diagnostics formatting](operations/exception-diagnostics-formatting.md) | 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](operations/batch-log-message-writing.md) | 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](business-rules.md#br-001-batch-log-stream-must-resolve-to-a-valid-file), [BR-006](business-rules.md#br-006-standardfile-batch-log-stream-is-recreated-on-every-write) | — | — |

## 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.

```mermaid
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](business-rules.md#br-003-command-line-validation-gates-application-logic)).
- 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](business-rules.md#br-001-batch-log-stream-must-resolve-to-a-valid-file)).
- 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](business-rules.md#br-006-standardfile-batch-log-stream-is-recreated-on-every-write)).
- 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](business-rules.md#br-005-command-line-parameter-names-match-by-prefix-not-exact-equality)).
- See each operation's detail page under `operations/` for the complete set of failure and edge-case behaviors.

## Related documentation
- [Index](index.md)
- [Overview](overview.md)
- [Architecture](architecture.md)
- [Dependencies](dependencies.md)
- [Business rules](business-rules.md)
- [API reference](api/index.md)

## Sources
- `Presentation\SAIF.Presentation.ConsoleApplication\clsConsoleBase.vb`
- `Presentation\SAIF.Presentation.ConsoleApplication\clsBatchBase.vb`
