---
title: "SQL-149: Retrieve County via GetCountyNames"
summary: Read operation against County via NHibernate ORM.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-24
library: SAIF.Services
reference_type: package
---

# SQL-149: Retrieve County via GetCountyNames

This ORM statement performs a read operation on `County` via `IUnitOfWork.GetRepository<T>()`, executed from `Services/SAIF.Services/Rct/RctXmlService.cs (L109)`.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| (none) | N/A | N/A | N/A | No inline filter — full-entity read (`Query().ToList()`/projection) or filters appended later |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [COUNTY](../database-tables.md#county) | SELECT | `COUNTY_CODE`, `STATE`, `COUNTY_NAME`, `OFFICE_CODE` |

## LINQ statement

Source: `Services/SAIF.Services/Rct/RctXmlService.cs:109`

```csharp
// Services/SAIF.Services/Rct/RctXmlService.cs:109-111
            var countyList = _unitOfWork.GetRepository<Data.Model.Collections.County>()
                .Query()
                .OrderBy(x => x.CountyName).ToList();
```

## Sample SQL

> **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
-- Services/SAIF.Services/Rct/RctXmlService.cs:109
SELECT
  C.COUNTY_CODE,
  C.STATE,
  C.COUNTY_NAME,
  C.OFFICE_CODE
FROM COUNTY C
ORDER BY C.COUNTY_NAME
```

## Operations and processes
- RctXmlService.GetCountyNames — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Rct/RctXmlService.cs (L109)`
