Skip to content

SQL-284: PolicyExtensions.GenerateRelationshipPolicies

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

Classification

Field Value
SQL ID SQL-284
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

Tables

Table Access Columns used
MARKET_TYPE_CODE SELECT ×2 (hypothetical) CODE, DESCR

LINQ statement

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

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:131
var vol = uow.GetRepository<MarketTypeCode>().Query().SingleOrDefault(x => x.Code == MarketTypeCode.VoluntaryMarketTypeCode);

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:132
var arp = uow.GetRepository<MarketTypeCode>().Query().SingleOrDefault(x => x.Code == MarketTypeCode.AssignedRiskMarketTypeCode);

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 131: Code == "VOL"
SELECT
  MTC.CODE,
  MTC.DESCR
FROM MARKET_TYPE_CODE MTC
WHERE MTC.CODE = :p0  -- 'VOL'
-- SingleOrDefault

-- line 132: Code == "ARP"
SELECT
  MTC.CODE,
  MTC.DESCR
FROM MARKET_TYPE_CODE MTC
WHERE MTC.CODE = :p0  -- 'ARP'
-- SingleOrDefault

Translation notes: - String constants (and captured values) are bound as parameters by NHibernate (:p0); the literal is shown in the trailing comment. - MarketTypeCode.VoluntaryMarketTypeCode = "VOL", AssignedRiskMarketTypeCode = "ARP".

Sources

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