SQL-121: Retrieve CbpBillStatusCode¶
This ORM statement performs a read operation on CbpBillStatusCode via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Claims/Bills/BillEntryService.cs (L348, L374, L380).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-121 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | CbpBillStatusCode |
| Criteria property | N/A — ORM |
| Lifecycle method | CreateNewBill, GetBillStatusCodes, UpdateBillStatus |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
billStatusCode |
Input | ** | N/A | x.Code == billStatusCode → column CODE |
initialBillStatusCode |
Input | ** | N/A | x.Code == initialBillStatusCode → column CODE |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| CBP_BILL_STATUS_CODE | SELECT | CODE, UPDATE_NUM, CODE_DESCR, ACTIVE_FLAG, EXT_IW_CODE_DESCR, UPDATE_DATE, UPDATE_USER |
LINQ statement¶
Source: Services/SAIF.Services/Claims/Bills/BillEntryService.cs:348
// Services/SAIF.Services/Claims/Bills/BillEntryService.cs:348
var newStatusCode = unitOfWork.GetRepository<CbpBillStatusCode>().Query().SingleOrDefault(x => x.Code == billStatusCode);
// Services/SAIF.Services/Claims/Bills/BillEntryService.cs:374
return unitOfWork.GetRepository<CbpBillStatusCode>().Query().OrderBy(x => x.Description).ToList();
// Services/SAIF.Services/Claims/Bills/BillEntryService.cs:380
var initialBillStatus = unitOfWork.GetRepository<CbpBillStatusCode>().Query().SingleOrDefault(x => x.Code == initialBillStatusCode);
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
-- Services/SAIF.Services/Claims/Bills/BillEntryService.cs:348
SELECT
CBSC.CODE,
CBSC.UPDATE_NUM,
CBSC.CODE_DESCR,
CBSC.ACTIVE_FLAG,
CBSC.EXT_IW_CODE_DESCR,
CBSC.UPDATE_DATE,
CBSC.UPDATE_USER
FROM CBP_BILL_STATUS_CODE CBSC
WHERE CBSC.CODE = :billStatusCode
-- NHibernate expects at most one row
-- Services/SAIF.Services/Claims/Bills/BillEntryService.cs:374
SELECT
CBSC.CODE,
CBSC.UPDATE_NUM,
CBSC.CODE_DESCR,
CBSC.ACTIVE_FLAG,
CBSC.EXT_IW_CODE_DESCR,
CBSC.UPDATE_DATE,
CBSC.UPDATE_USER
FROM CBP_BILL_STATUS_CODE CBSC
ORDER BY CBSC.CODE_DESCR
-- Services/SAIF.Services/Claims/Bills/BillEntryService.cs:380
SELECT
CBSC.CODE,
CBSC.UPDATE_NUM,
CBSC.CODE_DESCR,
CBSC.ACTIVE_FLAG,
CBSC.EXT_IW_CODE_DESCR,
CBSC.UPDATE_DATE,
CBSC.UPDATE_USER
FROM CBP_BILL_STATUS_CODE CBSC
WHERE CBSC.CODE = :initialBillStatusCode
-- NHibernate expects at most one row
Translation notes:
- CODE is mapped twice in CbpBillStatusCodeMap.cs -> selected once.
Operations and processes¶
- BillEntryService.CreateNewBill — see Operations and processes
- BillEntryService.GetBillStatusCodes — see Operations and processes
- BillEntryService.UpdateBillStatus — see Operations and processes
Business rules¶
Sources¶
Services/SAIF.Services/Claims/Bills/BillEntryService.cs (L348, L374, L380)