---
title: EnvironmentManager
summary: API reference for EnvironmentManager.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# EnvironmentManager

Implements `IEnvironmentManager`, resolving which lowercase environment/machine names belong to a given environment group code (e.g. Dev, Test, QA, Prod) for the Online Support error-log filtering feature. It depends solely on `IOnlineSupportRepository`, from which it caches the full group/environment mapping at construction time.

## Purpose
- Translates a two-letter environment group code into the list of environment names that belong to that group, for use when filtering error logs by environment.
- Provides a special `"O"` ("Other") code that returns every known environment name, used as a catch-all/fallback group.

## Context
- Namespace: `SAIF.Services.OnlineSupport.ErrorLogs`
- Assembly/package: `SAIF.Services` (packaged inside the `SAIF.SAIFCode.Core` NuGet package)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| EnvironmentManager(...) | `public EnvironmentManager(IOnlineSupportRepository repository)` | Enforces that the repository is non-null and caches its full group-to-environment mapping (`EnvironmentsByGroup`) for the lifetime of this instance. |
| GetEnvironmentListForGroupCode | `public IEnumerable<string> GetEnvironmentListForGroupCode(string code)` | Returns an empty list for a null code; for code `"O"` returns every known environment name lowercased; otherwise returns the lowercased environment names whose group code case-insensitively matches `code`. |

## Behavioral notes
- Caches the environment/group mapping once in the constructor rather than re-querying `IOnlineSupportRepository` on each call, so changes to the underlying group/environment data made after construction are not reflected until a new instance is created*.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Sources
- Services/SAIF.Services/OnlineSupport/ErrorLogs/EnvironmentManager.cs
