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

# SQL-232: TaskQueryProvider.GetAction

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

## Classification

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

## Parameters

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

## Tables

| Table | Access | Columns used |
| --- | --- | --- |
| [TASK_ACTION_CODE](../database-tables.md#task_action_code) | SELECT | Code, CODE_DESCR |

## LINQ statement

Source: `Data/SAIF.Data/Queries/Tasks/TaskQueryProvider.cs:35`.

```csharp
// Data/SAIF.Data/Queries/Tasks/TaskQueryProvider.cs:35-36
return Factory.GetRepository<TaskAction>().Query()
    .SingleOrDefault(x => x.Code.ToLower() == code.ToLower());
```

## 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
SELECT
  TAC.Code,
  TAC.CODE_DESCR
FROM TASK_ACTION_CODE TAC
WHERE LOWER(TAC.Code) = :code  -- bound value = code.ToLower(), evaluated client-side
-- SingleOrDefault: NHibernate fetches and throws if more than one row
```

Translation notes:
- The identifier column of `TaskAction` is literally `Code` (FluentNHibernate default: `Id(x => x.Code)` without `.Column(...)`).
- `x.Code.ToLower()` on the mapped member → `LOWER(col)` server-side; `code.ToLower()` does not depend on the lambda parameter, so NHibernate's partial evaluator (re-linq) computes it in memory and binds the result as a parameter. The function wrapper prevents index use on the code column.

## Operations and processes

- [Other query providers](../operations/other-query-providers.md)

## Business rules

- [SD-BR-091 Task codes compared case-insensitively](../business-rules.md#sd-br-091-task-codes-compared-case-insensitively)

## Sources

- `Data/SAIF.Data/Queries/Tasks/TaskQueryProvider.cs:35`
