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

# SQL-293: PolicyOutputDocumentExtensions.SeedForDocumentTesting

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

## Classification

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [output_doc_notify_text_code](../database-tables.md#output_doc_notify_text_code) | SELECT ×3 (hypothetical) | code, code_descr, notification_text |
| [output_document_category_code](../database-tables.md#output_document_category_code) | SELECT ×2 (hypothetical) | code, code_descr |
| [image_document_type_code](../database-tables.md#image_document_type_code) ** | SELECT ×3 (hypothetical) | key columns; others -- unresolved mapping |
| [output_document_type_code](../database-tables.md#output_document_type_code) | INSERT ×679 (hypothetical) | code, code_descr, agency_view_flag, agency_inbox_flag, manual_add_flag, freeform_flag, sort_priority_num, SOURCE_SYSTEM_CODE, PACKAGE_NAME, image_file_code, image_category_code, image_document_type_code, output_document_category_code, Direct_Write_Notify_Text_Code |

## LINQ statement

Source: `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyOutputDocumentExtensions.cs:79`.

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyOutputDocumentExtensions.cs:79-80
uow.GetRepository<OutputDocumentTypeCode>().Seed(uow.GetRepository<OutputDocumentCategoryCode>(),
    uow.GetRepository<ImageDocumentTypeCode>(), uow.GetRepository<OutputDocumentNotifyTextCode>());

// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyOutputDocumentExtensions.cs:145-845
public static void Seed(this IRepository<OutputDocumentTypeCode> repo, IRepository<OutputDocumentCategoryCode> catRepo,
    IRepository<ImageDocumentTypeCode> imageDocTypeRepo, IRepository<OutputDocumentNotifyTextCode> notifyTextRepo)
{
    var notifyPol = notifyTextRepo.Query().SingleOrDefault(nt => nt.Code == OutputDocumentNotifyTextCode.PolicyDocumentNotifyTextCode);
    var notifyRetro = notifyTextRepo.Query().SingleOrDefault(nt => nt.Code == OutputDocumentNotifyTextCode.RetroDocumentNotifyTextCode);
    var notifyMod = notifyTextRepo.Query().SingleOrDefault(nt => nt.Code == OutputDocumentNotifyTextCode.ErmodDocumentNotifyTextCode);

    var pol = catRepo.Query().SingleOrDefault(x => x.Code == "POL");
    var fin = catRepo.Query().SingleOrDefault(x => x.Code == "FIN");

    var imageDocTypeCoverageC =
        imageDocTypeRepo.Query()
            .Single(x => x.Category.FileCode == "POLCY" && x.Category.Code == "C" && x.Code == "C");
    var imageDocTypePolicyP =
        imageDocTypeRepo.Query()
            .Single(x => x.Category.FileCode == "POLCY" && x.Category.Code == "P" && x.Code == "P");
    var imageDocTypePolicyF =
        imageDocTypeRepo.Query()
            .Single(x => x.Category.FileCode == "POLCY" && x.Category.Code == "F" && x.Code == "F");

    repo.Add(new OutputDocumentTypeCode { Code = "228", Description = "Simplified Assigned Risk Adjustment Program Endorsement", IsAgencyViewable = true, IsAgencyInboxViewable = true, IsManualAdd = false, ImageDocumentType = null, DocumentCategory = pol, DirectWriteNotifyText = notifyPol, SortOrder = 1022800 });
    // ... 678 further Add/AddCode call(s) through line 845 (elided)
}
```

## 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
-- lines 148-150
SELECT
  ODNTC.code,
  ODNTC.code_descr,
  ODNTC.notification_text
FROM output_doc_notify_text_code ODNTC
WHERE ODNTC.code = :p0  -- PolicyDocumentNotifyTextCode | Retro... | Ermod...
-- SingleOrDefault

-- lines 152-153
SELECT
  ODCC.code,
  ODCC.code_descr
FROM output_document_category_code ODCC
WHERE ODCC.code = :p0  -- 'POL' | 'FIN'
-- SingleOrDefault

-- lines 155-163
SELECT
  IDTC.image_file_code,
  IDTC.image_category_code,
  IDTC.code
  -- unresolved mapping: remaining ImageDocumentTypeCode columns
FROM image_document_type_code IDTC
WHERE IDTC.image_file_code = :p0  -- 'POLCY'
  AND IDTC.image_category_code = :p1  -- 'C' | 'P' | 'F' (column name inferred)
  AND IDTC.code = :p2
-- Single

-- lines 165-845
INSERT INTO output_document_type_code (
  code,
  code_descr,
  agency_view_flag,
  agency_inbox_flag,
  manual_add_flag,
  freeform_flag,
  sort_priority_num,
  SOURCE_SYSTEM_CODE,
  PACKAGE_NAME,
  image_file_code,
  image_category_code,
  image_document_type_code,
  output_document_category_code,
  Direct_Write_Notify_Text_Code)
VALUES (
  :Code,
  :Description,
  :IsAgencyViewable,
  :IsAgencyInboxViewable,
  :IsManualAdd,
  :IsFreeForm,
  :SortOrder,
  :SystemSourceCode,
  :PackageName,
  :ImageDocumentType,
  :ImageDocumentType,
  :ImageDocumentType,
  :DocumentCategory,
  :DirectWriteNotifyText)
-- issued 679 times
```

Translation notes:
- Not accessed: `output_doc_image_type_xref` (listed on the old page) — it is the `HasManyToMany(ImageDocumentTypes)` join table; none of the 679 `Add` calls sets `ImageDocumentTypes`, and no query touches it. `image_category_code` — `x.Category.FileCode`/`x.Category.Code` (lines 155-163) are the parts of `ImageCategoryCode`'s composite identifier used as `KeyReference(Category)`, so they short-circuit to the key columns of `image_document_type_code`; no join.
- Boolean flags use `YesNoType`; `ImageDocumentType = null` leaves the 3-column FK NULL on most rows.

## Sources

- `Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyOutputDocumentExtensions.cs:79`
