---
title: "SQL-282: PolicyExtensions.GenerateDefaultPolicies"
summary: Read operation for `PolicyExtensions.GenerateDefaultPolicies`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# SQL-282: PolicyExtensions.GenerateDefaultPolicies

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

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-282 |
| **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** | `GenerateDefaultPolicies` |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [MARKET_TYPE_CODE](../database-tables.md#market_type_code) | SELECT ×2 (hypothetical) | CODE, DESCR |

## LINQ statement

Source: `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:68`.

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:68
var volMarketType = uow.GetRepository<MarketTypeCode>().Query().SingleOrDefault(x => x.Code == "VOL");

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:69
var arpMarketType = uow.GetRepository<MarketTypeCode>().Query().SingleOrDefault(x => x.Code == "ARP");
```

## 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.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
-- line 68: Code == "VOL"
SELECT
  MTC.CODE,
  MTC.DESCR
FROM MARKET_TYPE_CODE MTC
WHERE MTC.CODE = :p0  -- 'VOL'
-- SingleOrDefault

-- line 69: 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.

## Sources

- `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:68`
