SQL-125: Retrieve CbpDiagnosis via GetBillDiagnosis¶
This ORM statement performs a read operation on CbpDiagnosis via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Claims/Bills/BillService.cs (L359).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-125 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | CbpDiagnosis |
| Criteria property | N/A — ORM |
| Lifecycle method | GetBillDiagnosis |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
x.DiagnosisCode |
Input | ** | N/A | y.DiagnosisCode == x.DiagnosisCode → column DIAGNOSIS_CODE |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| CBP_DIAGNOSIS | SELECT | DIAGNOSIS_CODE, UPDATE_NUM, ICD_VERSION_CODE, DIAGNOSIS_DESCR, DIAGNOSIS_SHORT_DESCR, DIAGNOSIS_CATEGORY_CODE, VALID_MEDICARE_REPORT_FLAG, EFF_DATE, EXP_DATE, UPDATE_USER, UPDATE_DATE |
LINQ statement¶
Source: Services/SAIF.Services/Claims/Bills/BillService.cs:357
// Services/SAIF.Services/Claims/Bills/BillService.cs:357-360
t.ForEach(x =>
{
var obj = unitOfWork.GetRepository<CbpDiagnosis>().Query()
.SingleOrDefault(y => y.DiagnosisCode == x.DiagnosisCode);
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/BillService.cs:359
SELECT
CD.DIAGNOSIS_CODE,
CD.UPDATE_NUM,
CD.ICD_VERSION_CODE,
CD.DIAGNOSIS_DESCR,
CD.DIAGNOSIS_SHORT_DESCR,
CD.DIAGNOSIS_CATEGORY_CODE,
CD.VALID_MEDICARE_REPORT_FLAG,
CD.EFF_DATE,
CD.EXP_DATE,
CD.UPDATE_USER,
CD.UPDATE_DATE
FROM CBP_DIAGNOSIS CD
WHERE CD.DIAGNOSIS_CODE = :DiagnosisCode
-- NHibernate expects at most one row
Translation notes:
- Executed once per element inside t.ForEach(...) (L357) - N+1 pattern; x.DiagnosisCode is a member of the in-memory contract object -> bind :DiagnosisCode.
Operations and processes¶
- BillService.GetBillDiagnosis — see Operations and processes
Sources¶
Services/SAIF.Services/Claims/Bills/BillService.cs (L359)