Skip to content

SQL-337: Retrieve TaskSource via SetCommonPropteryValues

This ORM statement performs a read operation on TaskSource, retrieving the single row where Code = 'COLL', via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Collections/GenerateTasksService.cs (L255). The SQL below is inferred from the LINQ expression and the TaskSource NHibernate mapping (TASK_SOURCE_CODE); it is not literal SQL text present in source.

Classification

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

Tables

Table Access Columns used
TASK_SOURCE_CODE SELECT Code, CODE_DESCR

LINQ statement

Source: Services/SAIF.Services/Collections/GenerateTasksService.cs:255

// Services/SAIF.Services/Collections/GenerateTasksService.cs:254
inTask.TaskSource =
         UnitOfWork.GetRepository<TaskDataModel.TaskSource>().Query().SingleOrDefault(x => x.Code == "COLL");

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
  TSC.Code,
  TSC.CODE_DESCR
FROM TASK_SOURCE_CODE TSC
WHERE TSC.Code = 'COLL'
-- NHibernate expects at most one row

Translation notes:

  • SingleOrDefault -> no row limit; NHibernate expects at most one row.

Operations and processes

Sources

  • Services/SAIF.Services/Collections/GenerateTasksService.cs (L255)