Skip to content

SQL-285: PolicyExtensions.GenerateRelationshipPolicies

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

Classification

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

Parameters

Parameter Direction Type Max length Description
relationship Input string N/A Method argument of PolicyExtensions.GenerateRelationshipPolicies bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
POLICY_RELATIONSHIP_CODE SELECT ×1 (hypothetical) CODE, CODE_DESCR

LINQ statement

Source: Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:133.

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:133
var rel = uow.GetRepository<PolicyRelationshipCode>().Query().SingleOrDefault(x => x.Code == relationship.ToUpper());

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 133
SELECT
  PRC.CODE,
  PRC.CODE_DESCR
FROM POLICY_RELATIONSHIP_CODE PRC
WHERE PRC.CODE = :p0
-- SingleOrDefault

Translation notes: - String constants (and captured values) are bound as parameters by NHibernate (:p0); the literal is shown in the trailing comment. - relationship.ToUpper() does not depend on the lambda parameter; it is evaluated in memory and bound as :p0.

Sources

  • Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:133