SQL-274: OnlineSupportExtensions.SeedForOnlineSupport¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by OnlineSupportExtensions.SeedForOnlineSupport.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-274 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| 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_CODE | INSERT ×10, SELECT (hypothetical) | CODE, DESCRIPTION |
LINQ statement¶
Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:56.
// Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:56-58
var groupRepo = unitOfWork.GetRepository<ErrorGroupCode>();
CreateEnvironmentGroups(groupRepo);
var groups = groupRepo.Query().ToList();
// Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:152-165
private static void CreateEnvironmentGroups(IRepository<ErrorGroupCode> repo)
{
repo.Add(new ErrorGroupCode { Code = "D", Description = "Dev" });
repo.Add(new ErrorGroupCode { Code = "T", Description = "Test" });
// ... 8 further Add/AddCode call(s) through line 165 (elided)
}
Sample SQL¶
Test double — no runtime SQL. This statement executes against
TestUnitOfWork/TestRepository<T>(in-memory,List<TEntity>-backed test doubles inSAIF.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 NHibernateIUnitOfWorkusing 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.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
INSERT INTO ERROR_GROUP_CODE (
CODE,
DESCRIPTION)
VALUES (
@Code,
@Description)
-- issued 10 time(s), CreateEnvironmentGroups lines 152-165
-- line 58: groupRepo.Query().ToList()
SELECT
EGC.CODE,
EGC.DESCRIPTION
FROM ERROR_GROUP_CODE EGC
Translation notes:
- The subsequent groups.SingleOrDefault(...) calls (lines 63-71) run on the in-memory list, not the database.
Sources¶
Data/SAIF.Data/TestRepository/RepositoryExtensions/OnlineSupportExtensions.cs:56