SQL-097: Retrieve BillService via GetSpendCategory¶
This ORM statement performs a read operation on BillService via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs (L229).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-097 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | BillService |
| Criteria property | N/A — ORM |
| Lifecycle method | GetSpendCategory |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
BillServiceCode.SubpoenaFee |
Input | ** | N/A | x.Code == BillServiceCode.SubpoenaFee → column CODE |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| BILL_SERVICE_CODE | SELECT | CODE, CODE_DESCR, GL_EXPENSE_ACCOUNT_NUM, SPEND_CATEGORY |
LINQ statement¶
Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs:229
// Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs:229-231
return _unitOfWork.GetRepository<BillService>()
.Query()
.Single(x => x.Code == BillServiceCode.SubpoenaFee).SpendCategory;
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/Legal/Subpoenas/SubpoenaPaymentService.cs:229
SELECT
BSC.CODE,
BSC.CODE_DESCR,
BSC.GL_EXPENSE_ACCOUNT_NUM,
BSC.SPEND_CATEGORY
FROM BILL_SERVICE_CODE BSC
WHERE BSC.CODE = 'LE101'
-- NHibernate expects at most one row
Translation notes:
- BillServiceCode.SubpoenaFee is the constant "LE101" (Core/SAIF.Core/Contracts/Legal/Bills/BillServiceCode.cs:12) -> inline literal.
- .SpendCategory is read from the materialized entity in memory; the full entity is selected.
Operations and processes¶
- SubpoenaPaymentService.GetSpendCategory — see Operations and processes
Sources¶
Services/SAIF.Services/Legal/Subpoenas/SubpoenaPaymentService.cs (L229)