---
title: "SQL-283: 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-283: PolicyExtensions.GenerateDefaultPolicies

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

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-283 |
| **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 |
| --- | --- | --- |
| [OFFICE_CODE](../database-tables.md#office_code) | SELECT ×3 (hypothetical) | CODE, CODE_DESCR, CANCELLATION_TRACK_CODE, LOC_SEQ_NUM, PMS_OFFICE_CODE, POLICY_REGION_CODE, POLICY_RENEWAL_TRACK_CODE |

## LINQ statement

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

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:71
var arpOffice = uow.GetRepository<OfficeCode>().Query().SingleOrDefault(oc => oc.Code == OfficeCode.AssignedRiskOfficeCode);

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:72
var serviceCenterOffice = uow.GetRepository<OfficeCode>().Query().SingleOrDefault(oc => oc.Code == OfficeCode.ServiceCenterOfficeCode);

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyExtensions.cs:73
var portlandOffice = uow.GetRepository<OfficeCode>().Query().SingleOrDefault(oc => oc.Code == "PORT");
```

## 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 71: Code == "HOME"
SELECT
  OC.CODE,
  OC.CODE_DESCR,
  OC.CANCELLATION_TRACK_CODE,
  OC.LOC_SEQ_NUM,
  OC.PMS_OFFICE_CODE,
  OC.POLICY_REGION_CODE,
  OC.POLICY_RENEWAL_TRACK_CODE
FROM OFFICE_CODE OC
WHERE OC.CODE = :p0  -- 'HOME'
-- SingleOrDefault

-- line 72: Code == "SERV"
SELECT
  OC.CODE,
  OC.CODE_DESCR,
  OC.CANCELLATION_TRACK_CODE,
  OC.LOC_SEQ_NUM,
  OC.PMS_OFFICE_CODE,
  OC.POLICY_REGION_CODE,
  OC.POLICY_RENEWAL_TRACK_CODE
FROM OFFICE_CODE OC
WHERE OC.CODE = :p0  -- 'SERV'
-- SingleOrDefault

-- line 73: Code == "PORT"
SELECT
  OC.CODE,
  OC.CODE_DESCR,
  OC.CANCELLATION_TRACK_CODE,
  OC.LOC_SEQ_NUM,
  OC.PMS_OFFICE_CODE,
  OC.POLICY_REGION_CODE,
  OC.POLICY_RENEWAL_TRACK_CODE
FROM OFFICE_CODE OC
WHERE OC.CODE = :p0  -- 'PORT'
-- SingleOrDefault
```

Translation notes:
- String constants (and captured values) are bound as parameters by NHibernate (`:p0`); the literal is shown in the trailing comment.
- `OfficeCode.AssignedRiskOfficeCode` = `"HOME"`, `OfficeCode.ServiceCenterOfficeCode` = `"SERV"` (constants in `SAIF.Data.Model`).

## Sources

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