---
title: Configuration settings
summary: Configuration keys consumed by this library, retrieval methods, and runtime dependencies.
status: draft
owner: <owner>
last_reviewed: 2026-09-15
library: SAIF.Framework.Windows
reference_type: package
---

# Configuration settings

`SAIF.Framework.Windows` is a thin configuration-orchestration and DI-composition framework rather than a fixed-setting consumer: it defines the mechanism for looking up a caller-supplied database instance-name key via `IEnvironmentService.GetConfigSetting`, wires `IEnvironmentService`/`DbConnectionManager` into three named NHibernate unit-of-work registrations (Oracle stateful, Oracle stateless, SQL Server), and reads no `ConfigurationManager.AppSettings`, custom `<configSections>`, or `ApplicationSettingsBase` values of its own.

## Configuration retrieval methods

| Method | Class / Interface | Namespace | Usage pattern |
| --- | --- | --- | --- |
| `IEnvironmentService.GetConfigSetting(string key)` | `IEnvironmentService` (external, `SAIF.Core.Services`, package `SAIF.Framework.Core`) | `SAIF.Core.Services` | Called once, inline, inside `DatabaseConfig.RegisterUnitOfWork` to resolve a database-instance name; the key itself (`EnvironmentConfigKey`) is supplied at runtime by the consuming application, not hard-coded in this library. |
| `IEnvironmentService.GetApplicationTrack()` | `IEnvironmentService` (external) | `SAIF.Core.Services` | Called once in `ProgramRunnerBase.Run()` to obtain the current environment "track" name for a console banner (`"Running as: {userId} on track: {track}"`); a dedicated property/method on the interface, not a `GetConfigSetting` keyed lookup. |
| `DbConnectionManager.GetConnectionStringForInstance(IEnvironmentService, string instanceName, string userName)` | `DbConnectionManager` (external, `SAIF.Services.Common`) | `SAIF.Services.Common` | Called from `OracleConfig.GetConnectionString` to resolve the Oracle connection string for the instance name obtained via `GetConfigSetting(EnvironmentConfigKey)`. |
| `DbConnectionManager.GetConnectionStringForSqlServer(IEnvironmentService, string serverName, string instanceName, string userName)` | `DbConnectionManager` (external, `SAIF.Services.Common`) | `SAIF.Services.Common` | Called from `SqlServerConfig.GetConnectionString` to resolve the SQL Server connection string for the instance name obtained via `GetConfigSetting(EnvironmentConfigKey)`. |
| `Environment.GetEnvironmentVariables(EnvironmentVariableTarget.Machine)` / `Environment.GetEnvironmentVariable(string)` | `System.Environment` (BCL) | `System` | Used by `ConsoleLogService` to discover machine-scoped OS environment variables matching `^file[0-4]` for log-file registration. This is OS-level environment variable access, distinct from `IEnvironmentService`/`GetConfigSetting`. |

## Environment API settings

Settings retrieved via `IEnvironmentService` (centralized environment configuration service).

| Setting key | Method | Data type | Purpose | Consuming class | Source |
| --- | --- | --- | --- | --- | --- |
| `<EnvironmentConfigKey>` (caller-supplied name; not a fixed literal defined in this library) | `GetConfigSetting` | `string` | Resolves a database instance name used to build a connection string for the registered unit of work. | `DatabaseConfig` (via `RegisterUnitOfWork`) | `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs` |

This library does not define what config key names exist; it only defines the mechanism (`DatabaseConfig.EnvironmentConfigKey` property, set by the constructor caller) for looking one up by name. The actual string literal key name is determined by the consuming application when it constructs an `OracleConfig`/`SqlServerConfig` instance (e.g., `new OracleConfig("MyDb", "MyDb.Instance", "AppUser")`) — no such call site exists inside this library itself.*

`GetApplicationTrack()` (`ProgramRunnerBase.Run()`) is a dedicated interface method, not a keyed `GetConfigSetting`/`GetSecureConfigSetting` lookup, and is therefore documented in the retrieval-methods table above rather than as a setting-key row. No `GetSecureConfigSetting` calls exist in this library — the secure settings catalog below is empty.

## AppSettings (Web.config)

None. No `<appSettings>` section exists in `Console\SAIF.Console\app.config` (the file contains only a `<runtime><assemblyBinding>` section with four binding redirects: NHibernate, Iesi.Collections, System.Runtime.CompilerServices.Unsafe, System.Text.Json). No `ConfigurationManager.AppSettings` call sites exist anywhere in this library's scanned source.

## Database connection configuration

Connection strings and database provider settings consumed by this library. Every connection parameter (`EnvironmentConfigKey`, `UserName`, `ServerName`, `ConfigName`) is supplied by the consuming application via the `OracleConfig`/`SqlServerConfig` constructors and forwarded through `AutofacExtensions.RegisterCommonDependencies(currentUserId, dataClassMapAssemblies, params DatabaseConfig[] configs)`; no literal connection strings, server names, or instance names are hard-coded in this library.

| Connection name | Provider | Retrieval method | Purpose | Source |
| --- | --- | --- | --- | --- |
| `oracle` (Oracle, stateful) | Oracle | `IEnvironmentService.GetConfigSetting(EnvironmentConfigKey)` → `DbConnectionManager.GetConnectionStringForInstance` | Application data-access unit of work backed by Oracle, registered under the Autofac factory name `"oracle"`; the resulting `NHibernateUnitOfWork` is named by the caller-supplied `ConfigName`. | `Console\SAIF.Console\Console\DatabaseConfigs\OracleConfig.cs`, `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs` |
| `oracleStateless` (Oracle, stateless) | Oracle | Same mechanism as `oracle`; selected when `OracleConfig.Stateless == true` ([BR-WIN-016](business-rules.md#br-win-016-oracle-factory-selection-driven-by-stateless-flag)) | Stateless-session variant of the Oracle unit of work, registered under the Autofac factory name `"oracleStateless"`. | `Console\SAIF.Console\Console\DatabaseConfigs\OracleConfig.cs`, `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs` |
| `sqlSever` (SQL Server) | SQL Server | `IEnvironmentService.GetConfigSetting(EnvironmentConfigKey)` plus `ServerName` (caller-supplied property, not itself a config-service key) → `DbConnectionManager.GetConnectionStringForSqlServer` | Application data-access unit of work backed by SQL Server, registered under the fixed Autofac factory name `"sqlSever"` (typo preserved verbatim from source); no stateless variant exists ([BR-WIN-015](business-rules.md#br-win-015-sql-server-has-no-stateless-factory-variant)). | `Console\SAIF.Console\Console\DatabaseConfigs\SqlServerConfig.cs`, `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs` |

Connection-string resolution detail:
- Oracle: `OracleConfig.GetConnectionString(env, instanceName)` → `DbConnectionManager.GetConnectionStringForInstance(env, instanceName, UserName)`.
- SQL Server: `SqlServerConfig.GetConnectionString(env, instanceName)` → `DbConnectionManager.GetConnectionStringForSqlServer(env, ServerName, instanceName, UserName)`.
- In both cases, `instanceName` is the value returned by `env.GetConfigSetting(EnvironmentConfigKey)`, computed inline at the call site inside `DatabaseConfig.RegisterUnitOfWork`.
- `DbConnectionManager` itself is external (`SAIF.Services.Common`) — its internal connection-string construction logic (e.g., which underlying config keys it reads) is outside this library's boundary and not traced here.

## Secure settings

None. No `GetSecureConfigSetting` calls, `SystemHashUtil.ComputeHash` usage, or `SystemType` references exist anywhere in this library's scanned source.

## Transitive configuration (from dependencies)

This library's own code does not define application-level config keys; it is a thin, generic pass-through mechanism (`DatabaseConfig.EnvironmentConfigKey`, `IEnvironmentService`, `DbConnectionManager`) that a consuming application uses to look up its own keys.

| Setting key | Method | Source dependency | Dependency type | Purpose |
| --- | --- | --- | --- | --- |
| `IEnvironmentService` contract (`GetConfigSetting`, `GetSecureConfigSetting`, `GetApplicationTrack`) | `GetConfigSetting` / `GetSecureConfigSetting` / `GetApplicationTrack` | SAIF.Framework.Core | NuGet | Defines the environment-service contract consumed by this library; the contract's implementation and any settings it itself requires are outside this library's scope. |
| `WindowsEnvironmentService`, `DbConnectionManager`, `ServiceRegistrations.RegisterCoreServicesForWindows` | (indirect, via `IEnvironmentService`) | SAIF.Services / SAIF.Services.Common | NuGet | Registered by `AutofacExtensions.RegisterCommonDependencies` as the concrete `IEnvironmentService` implementation for console applications; `DbConnectionManager` performs the actual connection-string construction. |
| `OracleConfigurationFactory`, `SqlServerConfigurationFactory`, `NHibernateUnitOfWork` | (indirect, via unit-of-work factories) | SAIF.Framework.Data.NHibernate | NuGet | Consumes the connection string and `dataClassMapAssemblies` produced/forwarded by this library; no independent `IEnvironmentService`/`AppSettings` usage detected at this library's call boundary. |

No `<ProjectReference>` elements exist in `SAIF.Framework.Windows.csproj` (all dependencies are `packages.config`-managed NuGet references), so there are no same-repo project dependencies to scan for transitive configuration.

## Configuration dependencies

| Dependency | Type | Required at | Impact if missing |
| --- | --- | --- | --- |
| `IEnvironmentService` implementation (`WindowsEnvironmentService`, registered unconditionally by `AutofacExtensions.RegisterCommonDependencies`) | Service (Autofac registration) | Container build / unit-of-work registration | `DatabaseConfig.RegisterUnitOfWork` and `ProgramRunnerBase.Run()` cannot resolve a connection string or application track; behavior on a missing/misconfigured `EnvironmentConfigKey` is determined entirely by `WindowsEnvironmentService`, not by this library.* |
| `DbConnectionManager` (external, `SAIF.Services.Common`) | Service (static/external call) | Unit-of-work registration (container build) | `OracleConfig.GetConnectionString`/`SqlServerConfig.GetConnectionString` cannot produce a connection string, so the corresponding named unit-of-work registration fails when first resolved. |
| `currentUserId` non-null argument | Method parameter | `AutofacExtensions.RegisterCommonDependencies` invocation | Enforced via `Enforce.ArgumentNotNull` ([BR-WIN-013](business-rules.md#br-win-013-registercommondependencies-requires-non-null-currentuserid)); a null value throws before any registration occurs. |

**Configuration dependency risks**
- No fallback/default value exists for `DatabaseConfig.EnvironmentConfigKey` — if a consuming application passes a key that does not exist in the resolved `IEnvironmentService` implementation's backing store, whether `GetConfigSetting` throws or returns null is determined by the external `WindowsEnvironmentService` implementation, not by this library.*
- `AutofacExtensions.RegisterCommonDependencies` unconditionally registers `WindowsEnvironmentService` `As<IEnvironmentService>()` — a consuming application cannot override this without either supplying its own registration afterward (last-registration-wins in Autofac) or replacing this framework's registration call entirely.
- This library performs no credential retrieval of its own; any database credentials are embedded in whatever `DbConnectionManager.GetConnectionStringForInstance`/`GetConnectionStringForSqlServer` (external) return, based on `UserName` — a plain-text constructor argument in this library's own code, not a secured value.
- `AutofacExtensions.RegisterCommonDependencies` enforces `currentUserId != null` ([BR-WIN-013](business-rules.md#br-win-013-registercommondependencies-requires-non-null-currentuserid)) but does not enforce that `EnvironmentConfigKey` is non-null/non-empty on any supplied `DatabaseConfig` — a null/empty key is passed straight through to `GetConfigSetting`, with resulting behavior determined entirely by the external `IEnvironmentService` implementation.

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts.

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

## Sources
- `Console\SAIF.Console\Console\DatabaseConfigs\DatabaseConfig.cs`
- `Console\SAIF.Console\Console\DatabaseConfigs\OracleConfig.cs`
- `Console\SAIF.Console\Console\DatabaseConfigs\SqlServerConfig.cs`
- `Console\SAIF.Console\Console\ProgramRunnerBase.cs`
- `Console\SAIF.Console\Console\AutofacExtensions.cs`
- `Console\SAIF.Console\Console\ConsoleLogService.cs`
- `Console\SAIF.Console\app.config`
- `Console\SAIF.Console\packages.config`
- `Console\SAIF.Console\SAIF.Framework.Windows.csproj`
