Skip to content

SQL-238: WorkerQueryProvider.GetPreferredContactMethod

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

Classification

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

Parameters

Parameter Direction Type Max length Description
code Input PreferredContactMethodCode N/A Method argument of WorkerQueryProvider.GetPreferredContactMethod bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
cl_pref_contact_method_code SELECT Code, CODE_DESCR, UPDATE_DATE, UPDATE_USER, UPDATE_NUM

LINQ statement

Source: Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:42.

// Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:42-45
return code.IsNull()
          ? string.Empty 
          :  Factory.GetRepository<PreferredContactMethodCode>()
    .Query().FirstOrDefault(x => x.Code == code.Code).Description;

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 *
FROM (
  SELECT
    CPCMC.Code,
    CPCMC.CODE_DESCR,
    CPCMC.UPDATE_DATE,
    CPCMC.UPDATE_USER,
    CPCMC.UPDATE_NUM
  FROM cl_pref_contact_method_code CPCMC
  WHERE CPCMC.Code = :Code)
WHERE ROWNUM <= 1

Translation notes: - code.IsNull() is evaluated in memory; when code is null no query is issued. - code.Code is a captured value (bound parameter). - .Description is read from the materialised entity in memory (would throw NullReferenceException if no row matches). - Identifier column is literally Code (no .Column(...) override on Id).

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Claims/WorkerQueryProvider.cs:42