Skip to content

SQL-307: TaskExtensions.FillTaskCategory

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by TaskExtensions.FillTaskCategory.

Classification

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

Tables

Table Access Columns used
TASK_SOURCE_CODE SELECT ×4 (hypothetical) Code, CODE_DESCR

LINQ statement

Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:51.

// Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:51
var image = uow.GetRepository<TaskSource>().Query().SingleOrDefault(x => x.Code == "IMAGE");

// Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:52
var wcis = uow.GetRepository<TaskSource>().Query().SingleOrDefault(x => x.Code == "WCIS");

// Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:95
TaskSource = uow.GetRepository<TaskSource>().Query().SingleOrDefault(x => x.Code == "CLAIM"),

// Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:104
TaskSource = uow.GetRepository<TaskSource>().Query().SingleOrDefault(x => x.Code == "COLL"),

Sample SQL

Test double — no runtime SQL. This statement executes against TestUnitOfWork/TestRepository<T> (in-memory, List<TEntity>-backed test doubles in SAIF.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 NHibernate IUnitOfWork using 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
-- line 51: Code == "IMAGE"
SELECT
  TSC.Code,
  TSC.CODE_DESCR
FROM TASK_SOURCE_CODE TSC
WHERE TSC.Code = :p0  -- 'IMAGE'
-- SingleOrDefault

-- line 52: Code == "WCIS"
SELECT
  TSC.Code,
  TSC.CODE_DESCR
FROM TASK_SOURCE_CODE TSC
WHERE TSC.Code = :p0  -- 'WCIS'
-- SingleOrDefault

-- line 95: Code == "CLAIM"
SELECT
  TSC.Code,
  TSC.CODE_DESCR
FROM TASK_SOURCE_CODE TSC
WHERE TSC.Code = :p0  -- 'CLAIM'
-- SingleOrDefault

-- line 104: Code == "COLL"
SELECT
  TSC.Code,
  TSC.CODE_DESCR
FROM TASK_SOURCE_CODE TSC
WHERE TSC.Code = :p0  -- 'COLL'
-- SingleOrDefault

Translation notes: - String constants (and captured values) are bound as parameters by NHibernate (:p0); the literal is shown in the trailing comment. - Lines 95 and 104 are inline lookups inside the TaskCategory initialisers of the same method (FillTaskCategory).

Sources

  • Data/SAIF.Data/TestRepository/RepositoryExtensions/TaskExtensions.cs:51