Skip to content

SQL-302: Retrieve StateCode via GetStateCodes

This statement retrieves every StateCode row ordered by code via a full-table NHibernate LINQ query, executed from Services/SAIF.Services/Collections/CollectionsService.cs (L1118) and materialized with .ToList(). It backs GetStateCodes, which supplies the complete list of state codes for collections processing. The StateCode entity maps to the ALL_STATES table, resolved through the Legends CLI because its ClassMap lives outside this repository (SAIF.Framework.Data.NHibernate); the column mappings themselves remain undocumented, so the SELECT list below cannot be reliably enumerated.

Classification

Field Value
SQL ID SQL-302
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object CollectionsService
Criteria property N/A — ORM
Lifecycle method GetStateCodes

Parameters

Parameter Direction Type Max length Description
(none) N/A N/A N/A Full-table read — no filter predicate

Tables

Table Access Columns used
ALL_STATES** SELECT Code -- unresolved mapping: StateCode.Code (remaining columns also unresolved)

LINQ statement

Source: Services/SAIF.Services/Collections/CollectionsService.cs:1118

// Services/SAIF.Services/Collections/CollectionsService.cs:1118-1119
return Mapper.Map<StateCode[]>(UnitOfWork.GetRepository<ContactDataModel.StateCode>()
    .Query().OrderBy(x => x.Code).ToList());

Sample SQL

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
SELECT
  /* column list not enumerable: StateCodeMap lives in SAIF.Framework.Data.NHibernate and its column mappings are not documented in Legends */
FROM ALL_STATES S
ORDER BY S.Code -- unresolved mapping: StateCode.Code

Translation notes: - Unresolved mapping (columns). Same resolution as SQL-301. Partial translation. - Full-table read ordered by Code; .ToList() materializes.

Operations and processes

Sources

  • Services/SAIF.Services/Collections/CollectionsService.cs (L1118)