SQL-171: LocationQueryProvider.GetLocationContacts¶
This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by LocationQueryProvider.GetLocationContacts.
Classification¶
| Field | Value |
|---|---|
| SQL ID | SQL-171 |
| Operation type | Read |
| Execution method | ORM (NHibernate LINQ) |
| Database | Oracle* |
| Schema | [unqualified]** |
| Command type | N/A (ORM-generated) |
| Business object | LocationQueryProvider |
| Criteria property | N/A — ORM |
| Lifecycle method | GetLocationContacts |
Parameters¶
| Parameter | Direction | Type | Max length | Description |
|---|---|---|---|---|
locationId |
Input | long | N/A | Method argument of LocationQueryProvider.GetLocationContacts bound into the ORM expression; NHibernate generates the bind variable at runtime |
Tables¶
| Table | Access | Columns used |
|---|---|---|
| CONTACT | SELECT | LOC_SEQ_NUM, CONTACT_TYPE_CODE, CONTACT_EFF_DATE, CONTACT_EXP_DATE, BUS_SEQ_NUM, CONTACT_FIRST_NAME, CONTACT_INITIAL, CONTACT_LAST_NAME, CONTACT_TITLE, CONTACT_PHONE, CONTACT_PHONE_EXT, EMAIL_ADDR, CELL_PHONE, CREATE_USER, CREATE_DATE, UPDATE_USER, UPDATE_DATE |
LINQ statement¶
Source: Data/SAIF.Data/Queries/Locations/LocationQueryProvider.cs:49-50.
public IQueryable<Contact> GetLocationContacts(long locationId)
{
return Factory.GetRepository<Contact>()
.Query().Where(x => x.Id == locationId && x.ExpirationDate == null).OrderBy(x => x.ContactType);
}
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
C.LOC_SEQ_NUM,
C.CONTACT_TYPE_CODE,
C.CONTACT_EFF_DATE,
C.CONTACT_EXP_DATE,
C.BUS_SEQ_NUM,
C.CONTACT_FIRST_NAME,
C.CONTACT_INITIAL,
C.CONTACT_LAST_NAME,
C.CONTACT_TITLE,
C.CONTACT_PHONE,
C.CONTACT_PHONE_EXT,
C.EMAIL_ADDR,
C.CELL_PHONE,
C.CREATE_USER,
C.CREATE_DATE,
C.UPDATE_USER,
C.UPDATE_DATE
FROM CONTACT C
WHERE C.LOC_SEQ_NUM = :locationId
AND C.CONTACT_EXP_DATE IS NULL
ORDER BY C.CONTACT_TYPE_CODE
Translation notes:
- ContactMap uses a composite key: LOC_SEQ_NUM (the Id property), CONTACT_TYPE_CODE (ContactType), and CONTACT_EFF_DATE (EffectiveDate).
- The method returns IQueryable<Contact>; execution is deferred to the caller.
Operations and processes¶
Business rules¶
Sources¶
Data/SAIF.Data/Queries/Locations/LocationQueryProvider.cs:49