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

# SQL-172: Retrieve DocumentTemplateParameter via GetDocumentTemplateParameters

This statement reads `DocumentTemplateParameter` rows for a document template, ordered by parameter number, so `GetDocumentTemplateParameters` can present the template's configurable parameters. `DocumentTemplateParameter` has no `ClassMap` anywhere in this repository or in the external mapping package queried via Legends, so the table and column names below are unresolved and shown as C# property names.

## Classification

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

## Parameters

| Parameter | Direction | Type | Max length | Description |
| --- | --- | --- | --- | --- |
| `:inTemplateId` | Input | long | N/A | `a.TemplateId == inTemplateId` → column TemplateId (unresolved) |

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [DocumentTemplateParameter](../database-tables.md#documenttemplateparameter)** | SELECT | Id, TemplateId, ParameterNumber, XmlName, XmlGroup, DataSource, DataType, Prompt, DefaultValueTxt, IsViewable, IsRequired, CreateUser, CreateDate, UpdateUser, UpdateDate, UpdateNumber (C# property names — unresolved mapping) |

## LINQ statement

Source: `Services/SAIF.Services/Documents/DocumentParameterService.cs:94`

```csharp
IEnumerable<DataModel.DocumentTemplateParameter> templateParameters = UnitOfWork.GetRepository<DataModel.DocumentTemplateParameter>().Query()
                .Where(a => a.TemplateId == inTemplateId)
                .OrderBy(a => a.ParameterNumber);
```

## 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
-- unresolved mapping: DocumentTemplateParameter (no ClassMap in repo; Legends returned no mapping) — C# names used
SELECT DTP.Id, DTP.TemplateId, DTP.ParameterNumber, DTP.XmlName, DTP.XmlGroup, DTP.DataSource, DTP.DataType,
       DTP.Prompt, DTP.DefaultValueTxt, DTP.IsViewable, DTP.IsRequired, DTP.CreateUser, DTP.CreateDate,
       DTP.UpdateUser, DTP.UpdateDate, DTP.UpdateNumber            -- unresolved mapping: DocumentTemplateParameter.*
FROM   DocumentTemplateParameter DTP                                  -- unresolved mapping: DocumentTemplateParameter (table)
WHERE  DTP.TemplateId = :inTemplateId                                 -- unresolved mapping: DocumentTemplateParameter.TemplateId
ORDER BY DTP.ParameterNumber;                                         -- unresolved mapping: DocumentTemplateParameter.ParameterNumber
```

Translation notes:
- ** = unresolved mapping. Model class `Data/SAIF.Data/Model/Documents/DocumentTemplateParameter.cs` has no `ClassMap<DocumentTemplateParameter>` anywhere in the repo, and Legends returned no mapping.
- Assigned to `IEnumerable`; executes when enumerated.

## Operations and processes
- DocumentParameterService.GetDocumentTemplateParameters — see [Operations and processes](../operations-processes.md)

## Sources
- `Services/SAIF.Services/Documents/DocumentParameterService.cs (L94)`
