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

# SQL-295: PolicyOutputDocumentExtensions.GetDocStatus

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

## Classification

| Field | Value |
| --- | --- |
| **SQL ID** | SQL-295 |
| **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** | `GetDocStatus` |

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `code` | Input | string | N/A | Method argument of `PolicyOutputDocumentExtensions.GetDocStatus` bound into the ORM expression; NHibernate generates the bind variable at runtime |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [document_status_code](../database-tables.md#document_status_code) | SELECT (hypothetical) | code, code_descr |

## LINQ statement

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

```csharp
// Data/SAIF.Data/TestRepository/RepositoryExtensions/PolicyOutputDocumentExtensions.cs:88
return uow.GetRepository<DocumentStatusCode>().Query().SingleOrDefault(x => x.Code.ToUpper() == code.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.

```sql
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
  DSC.code,
  DSC.code_descr
FROM document_status_code DSC
WHERE UPPER(DSC.code) = :code  -- bound value = code.ToUpper(), evaluated client-side
-- SingleOrDefault
```

Translation notes:
- `x.Code.ToUpper()` → `UPPER(code)` server-side; `code.ToUpper()` is partially evaluated in memory.

## Sources

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