Skip to content

SQL-146: Retrieve CollectionCode via GetCollectionCodes

This ORM statement performs a read operation on CollectionCode via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Collections/CollectionsService.cs (L1077).

Classification

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

Parameters

Parameter Direction Type Max length Description
(none) N/A N/A N/A No inline filter — full-entity read (Query().ToList()/projection) or filters appended later

Tables

Table Access Columns used
LEGAL_COLLECTION_CODE SELECT Code, CODE_DESCR

LINQ statement

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

// Services/SAIF.Services/Collections/CollectionsService.cs:1077-1078
            return Mapper.Map<CollectionCode[]>(UnitOfWork.GetRepository<DataModel.CollectionCode>()
                .Query().OrderBy(x => x.Description).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
-- Services/SAIF.Services/Collections/CollectionsService.cs:1077
SELECT
  LCC.Code,
  LCC.CODE_DESCR
FROM LEGAL_COLLECTION_CODE LCC
ORDER BY LCC.CODE_DESCR

Translation notes: - Id(x => x.Code) has no .Column(...) (CollectionCodeMap.cs) and no FluentNHibernate conventions exist in the repository -> NHibernate default column name Code.

Operations and processes

Sources

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