---
title: "SQL-245: OnlineSupportExtensions.SeedForOnlineSupport"
summary: Create operation for `OnlineSupportExtensions.SeedForOnlineSupport`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-245: OnlineSupportExtensions.SeedForOnlineSupport

This statement is a create operation invoked through ORM (IRepository.Add). Executed by `OnlineSupportExtensions.SeedForOnlineSupport`.

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-245 |
| **Operation type** | Create |
| **Execution method** | ORM (IRepository.Add) |
| **Database** | SQL Server* |
| **Schema** | [unqualified]** |
| **Command type** | N/A (ORM-generated) |
| **Business object** | `OnlineSupportExtensions` |
| **Criteria property** | N/A — ORM |
| **Lifecycle method** | `SeedForOnlineSupport` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [ERROR_GROUP_ENVIRONMENT](../database-tables.md#error_group_environment) | INSERT ×14 (hypothetical) | ID, ERROR_GROUP, ENVIRONMENT |

## LINQ statement

Source: `Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:74`.

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:74
var envRepo = unitOfWork.GetRepository<ErrorGroupEnvironment>();

// Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:79-81
var envs = environments.Query().ToList();

envRepo.Add(new ErrorGroupEnvironment { Id = (counter++), Environment = envs.SingleOrDefault(x => x.EnvironmentName.ToLower() == "webs"), Group = sysGroup });
```

## Sample SQL

> **Test double — no runtime SQL.** This statement executes against `TestUnitOfWork`/`TestRepository<T>` (in-memory, `List<TEntity>`-backed test doubles in `SAIF.Framework.Core`); no NHibernate session is opened and no SQL is issued at runtime. The SQL below is the hypothetical statement the same expression would produce against a real NHibernate `IUnitOfWork` using the in-repo mappings, shown to document the mapping shape only — **no database table is accessed when this code runs.**

> **Inferred SQL:** This SQL was inferred from the LINQ statement above and the NHibernate mappings. It is not concrete SQL from source code; NHibernate generates the executed statement at runtime, so aliases, column order, join syntax, and bind-parameter names may differ.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
INSERT INTO ERROR_GROUP_ENVIRONMENT (
  ID,
  ERROR_GROUP,
  ENVIRONMENT)
VALUES (
  @Id,
  @Group,
  @Environment)
-- issued 14 times (lines 81-94); SQL Server parameter prefix @
```

Translation notes:
- Not accessed: `ERROR_ENVIRONMENT`, `ERROR_GROUP_CODE` — `envs.SingleOrDefault(...)` and `groups.SingleOrDefault(...)` run on in-memory `List<T>` (materialised at lines 58 and 79), not on the repository; the references contribute FK values only.
- `Id` is assigned by the caller (`counter++`).
- The reads that populate `envs`/`groups` are SQL-275/SQL-274.

## Sources

- `Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:74`
