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

# SQL-080: Retrieve Agent via GetAgentData

This ORM statement performs a read operation on `Agent` via `IUnitOfWork.GetRepository<T>()`, executed from `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs (L521)`.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `agentId` | Input | ** | N/A | `a.Id == agentId` → column agent_num |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [AGENT](../database-tables.md#agent) | SELECT | `agent_num`, `agent_name`, `agent_exp_date`, `agency_seq_num`, `mail_addr_loc_seq_num` |

## LINQ statement

Source: `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs:521`

```csharp
// Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs:521-523
            return unitOfWork.GetRepository<Agent>()
                    .Query()
                    .SingleOrDefault(a => a.Id == agentId);
```

## 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/Policies/Certificates/Information/CertificateInformationService.cs:521
SELECT
  A.agent_num,
  A.agent_name,
  A.agent_exp_date,
  A.agency_seq_num,
  A.mail_addr_loc_seq_num
FROM Agent A
WHERE A.agent_num = :agentId
-- NHibernate expects at most one row
```

## Operations and processes
- CertificateInformationService.GetAgentData — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Policies/Certificates/Information/CertificateInformationService.cs (L521)`
