Skip to content

SAIF.Framework.Windows overview

Documentation context: Packaged Component (NuGet)

SAIF.Framework.Windows (packaged as SAIF.Framework.Windows, assembly SAIF.Framework.Console, root namespace SAIF.Console) is a Framework4-classified, generic console/batch-application composition framework. It supplies the entry-point orchestration, command-line argument parsing/validation, console logging, and Autofac-based NHibernate unit-of-work DI wiring that a consuming console application builds on top of, but it defines no concrete application, entity mappings, or authorization logic of its own.

Purpose

  • Provide a reusable base for building SAIF console/batch applications: an entry-point orchestrator, an application lifecycle base class, a command-line argument parsing/validation pipeline, a console/file logging subsystem, and Autofac-based data-access composition wiring.
  • Consumed by SAIF console/batch applications that derive from ProgramRunnerBase/SaifStandardProgramBase and ConsoleBase to obtain standardized argument handling, logging, exit-code semantics, and Oracle/SQL Server unit-of-work registration without re-implementing this scaffolding in every application.

Responsibilities

  • Orchestrate the console application entry point: argument resolution, Autofac container composition, application resolution, and exception-to-exit-code translation.
  • Own the application lifecycle (Initialize()/Execute()/Finish()) and run timing via ConsoleBase.
  • Parse and validate command-line arguments through a reflection-driven resolver pipeline.
  • Provide console and numbered-file logging via IConsoleLogService/ConsoleLogService and ILogWriter/LogWriter.
  • Compose Oracle and SQL Server NHibernate unit-of-work registrations into a consuming application's Autofac container via AutofacExtensions.RegisterCommonDependencies and DatabaseConfig/OracleConfig/SqlServerConfig.
  • Define a typed exception/exit-code hierarchy (SaifConsoleException and subclasses) that maps thrown exceptions to process exit codes.

Key components

  • ProgramRunnerBase<TApplication, TArgumentContainer> / SaifStandardProgramBase<TApp, TArgContainer>: entry-point orchestrator and standardized Main() scaffolding.
  • ConsoleBase<TArgContainer>: application lifecycle base class (Initialize/Execute/Finish, run timing, header/footer logging).
  • ICommandLineParser / PatternCommandLineParser / SaifStandardCommandLineParser: regex-driven command-line argument parsing.
  • ArgumentContainerBase<TArgumentContainer> / StandardArgumentContainerBase<TArgumentContainer> / ArgumentResolverBuilder<TArgumentContainer> / ArgumentResolver<TArgumentContainer, TArgument>: reflection-driven argument binding and validation.
  • IConsoleLogService/ConsoleLogService, ILogWriter/LogWriter: console and numbered environment-variable-driven file logging.
  • DatabaseConfig / OracleConfig / SqlServerConfig, AutofacExtensions: Autofac composition of Oracle/SQL Server NHibernate unit-of-work factories.
  • SaifConsoleException and subclasses (BadParameterException, CustomErrorException, DatabaseErrorException, DataErrorException, FileInputOutputException, NoDataFoundException): typed exception/exit-code hierarchy.

Sources

  • Console\SAIF.Console\SAIF.Framework.Windows.csproj
  • Console\SAIF.Console\SAIF.Framework.Windows.nuspec