Skip to content

SQL-071: Retrieve ActivityCode via GetActivityCodes

This ORM statement performs a read operation on ActivityCode via GetActivityCodes, executed from Services/SAIF.Services/Collections/CollectionsService.cs (L99-101).

Classification

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

Parameters

Parameter Direction Type Max length Description
(none) N/A N/A N/A No bind parameters

Tables

Table Access Columns used
LEGAL_COLL_ACTIVITY_CODE SELECT Code, CODE_DESCR

LINQ statement

Source: Services/SAIF.Services/Collections/CollectionsService.cs:99-101.

// Services/SAIF.Services/Collections/CollectionsService.cs:99
var data = UnitOfWork.GetRepository<DataModel.ActivityCode>().Query().OrderBy(x => x.Description).ToList();
data.Insert(0, new DataModel.ActivityCode() { Code = " ", Description = "--Select--" });
return Mapper.Map<ActivityCode[]>(data);

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
  LCAC.Code,
  LCAC.CODE_DESCR
FROM LEGAL_COLL_ACTIVITY_CODE LCAC
ORDER BY LCAC.CODE_DESCR

Translation notes: - Id(x => x.Code) declares no .Column(...), so FluentNHibernate uses the property name Code as the column name (unquoted; Oracle resolves it as CODE). - .ToList() executes the query; data.Insert(0, new DataModel.ActivityCode { Code = " ", Description = "--Select--" }) (line 100) is an in-memory list operation and produces no SQL.

Operations and processes

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

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