---
title: SAIF.Framework.Windows operations and processes
summary: Business and technical operations supported by this library.
status: draft
owner: <owner>
last_reviewed: 2026-09-15
library: SAIF.Framework.Windows
reference_type: package
---

# SAIF.Framework.Windows operations and processes

This page is the operation catalog and cross-operation hub for this library. Each operation's detailed, step-by-step logic lives in its own page under `operations/`.

## Operation catalog

| Operation | Intent | Trigger | Inputs | Outputs | Rules |
| --- | --- | --- | --- | --- | --- |
| [Program runner entry point](operations/program-runner-run.md) | Resolve arguments, compose the Autofac container, resolve the application, run it, and translate exceptions to a process exit code. | Consuming application's `Main()` calls `Run()` on a `ProgramRunnerBase`/`SaifStandardProgramBase` subclass. | `RawArguments` (raw command-line string array). | `Environment.ExitCode`; console/stderr output. | [BR-WIN-001](business-rules.md#br-win-001-argument-validation-precedes-application-execution), [BR-WIN-003](business-rules.md#br-win-003-invalid-arguments-halt-before-application-logic), [BR-WIN-004](business-rules.md#br-win-004-saifconsoleexception-supplies-its-own-exit-code), [BR-WIN-005](business-rules.md#br-win-005-unhandled-exceptions-default-to-exit-code-5) |
| [Console application lifecycle](operations/console-base-run.md) | Execute the `Initialize()`/`Execute()`/`Finish()` lifecycle for the resolved application instance. | Called by the program runner entry point after the Autofac container resolves the application. | Application instance state established at construction (`Arguments`, `StartTime`, injected `IConsoleLogService`). | `Environment.ExitCode` reset to `0`; console header/footer log lines. | [BR-WIN-006](business-rules.md#br-win-006-successful-initialize-resets-exit-code) |
| [Argument resolution](operations/resolve-arguments.md) | Parse and validate raw command-line arguments against the argument container's configured/auto-discovered resolvers. | Called by the program runner entry point (step 2 of `Run()`). | Raw `string[] args`, parsed into a dictionary via the container's `ICommandLineParser`. | A `ValidationResult` (`IsValid`, `Errors`). | [BR-WIN-002](business-rules.md#br-win-002-unconfigured-argument-properties-must-be-convertible-or-explicitly-configured), [BR-WIN-007](business-rules.md#br-win-007-convertible-properties-auto-register), [BR-WIN-008](business-rules.md#br-win-008-non-convertible-unconfigured-properties-fail-validation), [BR-WIN-009](business-rules.md#br-win-009-missing-required-arguments-fail-validation), [BR-WIN-010](business-rules.md#br-win-010-argument-value-conversion-failures-fail-validation) |
| [Command-line argument parsing](operations/parse-command-line-arguments.md) | Split raw argument tokens into standardized key/value pairs using a configurable regex pattern. | Called from the argument container's constructor via its configured `CommandLineParser`. | Raw `string[] args`; the parser's configured `ParsePattern` regex. | `Dictionary<string,string>` of standardized-key → value pairs. | [BR-WIN-011](business-rules.md#br-win-011-flag-only-arguments-default-to-true), [BR-WIN-012](business-rules.md#br-win-012-first-occurrence-of-duplicate-argument-keys-wins) |
| [Dependency and unit-of-work registration](operations/register-common-dependencies.md) | Wire core framework services and Oracle/SQL Server NHibernate unit-of-work factories/instances into the consuming application's Autofac container. | Called once from a consuming application's `RegisterAppDependencies` override (invoked from the program runner entry point). | `currentUserId`, optional `dataClassMapAssemblies`, `params DatabaseConfig[] configs`. | Autofac registrations added to the supplied `ContainerBuilder`. | [BR-WIN-013](business-rules.md#br-win-013-registercommondependencies-requires-non-null-currentuserid), [BR-WIN-015](business-rules.md#br-win-015-sql-server-has-no-stateless-factory-variant), [BR-WIN-016](business-rules.md#br-win-016-oracle-factory-selection-driven-by-stateless-flag) |
| [Console log service discovery](operations/console-log-service-discovery.md) | Discover machine-scoped numbered log-file environment variables and register a log writer per match. | Autofac resolution of `IConsoleLogService` (registered by dependency registration). | Machine-scoped environment variables (`Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Machine)`). | A populated `loggers` list of `LogWriter` instances. | [BR-WIN-014](business-rules.md#br-win-014-log-file-environment-variables-map-to-fixed-log-types) |

## Process flow diagram
The following diagram visualizes the primary operational flow from process entry to exit.

```mermaid
flowchart TD
	Start([Main invokes Run]) --> Resolve[Argument resolution]
	Resolve --> Valid{Arguments valid?}
	Valid -->|No| Halt([ExitCode=1, halt before app logic])
	Valid -->|Yes| Register[Dependency and unit-of-work registration]
	Register --> Build[Build Autofac container]
	Build --> Lifecycle[Console application lifecycle<br>Initialize/Execute/Finish]
	Lifecycle --> Outcome{Exception thrown?}
	Outcome -->|SaifConsoleException| ExitEx([ExitCode = ex.ExitCode])
	Outcome -->|Other exception| Exit5([ExitCode = 5])
	Outcome -->|No| Exit0([ExitCode = 0])
```

## Failure and edge-case behavior
- Invalid arguments halt the process before any dependency registration, container build, or application resolution occurs, and require a console keypress before exiting ([BR-WIN-003](business-rules.md#br-win-003-invalid-arguments-halt-before-application-logic)).
- A thrown `SaifConsoleException` maps to its own `ExitCode`; any other unhandled exception maps to a fixed exit code of `5` ([BR-WIN-004](business-rules.md#br-win-004-saifconsoleexception-supplies-its-own-exit-code), [BR-WIN-005](business-rules.md#br-win-005-unhandled-exceptions-default-to-exit-code-5)).
- A missing `currentUserId` argument to dependency registration throws immediately, before any registrations are added to the container ([BR-WIN-013](business-rules.md#br-win-013-registercommondependencies-requires-non-null-currentuserid)).
- Duplicate machine-scoped log-file environment variables pointing at the same file path are not deduplicated during log service discovery.

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

## Sources
- `Console\SAIF.Console\Console\ProgramRunnerBase.cs`
- `Console\SAIF.Console\Console\SaifStandardProgramBase.cs`
- `Console\SAIF.Console\Console\ConsoleBase.cs`
- `Console\SAIF.Console\Console\Arguments\ArgumentContainerBase.cs`
- `Console\SAIF.Console\Console\PatternCommandLineParser.cs`
- `Console\SAIF.Console\Console\AutofacExtensions.cs`
- `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs`
- `Console\SAIF.Console\Console\ConsoleLogService.cs`
- `Console\SAIF.Console\Console\LogWriter.cs`
