SQL-148: Retrieve County via GetCountyCodes¶
This ORM statement performs a read operation on County via IUnitOfWork.GetRepository<T>(), executed from Services/SAIF.Services/Collections/CollectionsService.cs (L1102).
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-148 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | County |
| Criteria property | N/A — ORM |
| Lifecycle method | GetCountyCodes |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
"OR" |
Input | ** | N/A | n.State == "OR" → column ** |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| COUNTY | SELECT | COUNTY_CODE, STATE, COUNTY_NAME, OFFICE_CODE |
LINQ statement¶
Source: Services/SAIF.Services/Collections/CollectionsService.cs:1102
// Services/SAIF.Services/Collections/CollectionsService.cs:1102-1105
var lst = UnitOfWork.GetRepository<DataModel.County>()
.Query()
.Where(n => n.State == "OR")
.OrderBy(x => x.CountyName).ToList();
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/Collections/CollectionsService.cs:1102
SELECT
C.COUNTY_CODE,
C.STATE,
C.COUNTY_NAME,
C.OFFICE_CODE
FROM COUNTY C
WHERE C.STATE = 'OR'
ORDER BY C.COUNTY_NAME
Translation notes:
- OFFICE_CODE is .ReadOnly() - still selected.
Operations and processes¶
- CollectionsService.GetCountyCodes — see Operations and processes
Sources¶
Services/SAIF.Services/Collections/CollectionsService.cs (L1102)