SQL-334: Retrieve TaskPriority¶
This ORM statement performs a read operation on TaskPriority, retrieving the single row matching a literal Code value (URG or INFO), via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs (L625, L640, L969). The SQL below is inferred from the LINQ expressions and the TaskPriority NHibernate mapping (TASK_PRIORITY_CODE); it is not literal SQL text present in source.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-334 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | TaskPriority |
| Criteria property | N/A — ORM |
| Lifecycle method | FillTaskData, ReassignTasks |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| TASK_PRIORITY_CODE | SELECT | Code, CODE_DESCR |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs:625
// Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs:625
var urgentTaskPriority = _unitOfWork.GetRepository<TaskData.TaskPriority>().Query().SingleOrDefault(x => x.Code == TaskPriority.Urgent);
// Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs:640
taskData.TaskPriority = _unitOfWork.GetRepository<TaskData.TaskPriority>().Query()
.SingleOrDefault(x => x.Code == TaskPriority.Info);
// Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs:969
var urgentTaskPriority = _unitOfWork.GetRepository<TaskData.TaskPriority>().Query().SingleOrDefault(x => x.Code == TaskPriority.Urgent);
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.
-- Inferred from LINQ (NHibernate mapping translation); not concrete SQL
SELECT
TPC.Code,
TPC.CODE_DESCR
FROM TASK_PRIORITY_CODE TPC
WHERE TPC.Code = 'URG' -- lines 625 and 969 (TaskPriority.Urgent); line 640 uses 'INFO' (TaskPriority.Info)
-- NHibernate expects at most one row
Translation notes:
SingleOrDefault-> no row limit; NHibernate expects at most one row.TaskPriorityhere isSAIF.Core.Contracts.Tasks.TaskPriority(the data type is aliasedTaskData):Urgent = "URG",Info = "INFO"(Core/SAIF.Core/Contracts/Tasks/TaskPriority.cs:7,11).
Operations and processes¶
- LegalTaskService.FillTaskData — see Operations and processes
- LegalTaskService.ReassignTasks — see Operations and processes
Sources¶
Services/SAIF.Services/Legal/Tasks/LegalTaskService.cs (L625, L640, L969)