SQL-072: Retrieve AdjustmentReason via SaveBillServices¶
This ORM statement performs a read operation on AdjustmentReason via SaveBillServices, executed from Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L444-448).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-072 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | AdjustmentReason |
| Criteria property | N/A — ORM |
| Lifecycle method | SaveBillServices |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
:Code |
Input | string |
N/A | Captured member legalBillService.AdjustmentReason.Code |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| ADJUSTMENT_REASON_CODE | SELECT | CODE, CODE_DESCR, CODE_LONG_DESCR, MAIL_MERGE_TEXT |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Bills/BillSaveService.cs:444-448.
// Services/SAIF.Services/Legal/Bills/BillSaveService.cs:444
billService.AdjustmentReason = legalBillService.AdjustmentReason == null
? null
: _unitOfWork.GetRepository<BillData.AdjustmentReason>()
.Query()
.SingleOrDefault(x => x.Code == legalBillService.AdjustmentReason.Code);
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
ARC.CODE,
ARC.CODE_DESCR,
ARC.CODE_LONG_DESCR,
ARC.MAIL_MERGE_TEXT
FROM ADJUSTMENT_REASON_CODE ARC
WHERE ARC.CODE = :Code
-- NHibernate expects at most one row
Translation notes:
- The query executes only when legalBillService.AdjustmentReason != null (C# conditional at line 444); otherwise no SQL is issued.
- Code / Description are inherited from CodeTableEntity<AdjustmentReason>; the map declares Id(x => x.Code).Column("CODE").
- The neighbouring BillService and BillServiceRateType lookups (lines 438-443) are separate statements, not part of this SQL ID.
Operations and processes¶
- BillSaveService.SaveBillServices — see Operations and processes
Note: Statements marked with
**could not be confirmed; treat as unknown until verified.
Sources¶
Services/SAIF.Services/Legal/Bills/BillSaveService.cs (L446)