Skip to content

SQL-076: Retrieve Agency via GetAgency

This ORM statement performs a read operation on Agency via GetAgency, executed from Services/SAIF.Services/Agencies/Imaging/ImageService.cs (L247).

Classification

Field Value
SQL ID SQL-076
Operation type Read
Execution method ORM (NHibernate LINQ)
Database Oracle
Schema [unqualified]**
Command type N/A (ORM-generated)
Business object Agency
Criteria property N/A — ORM
Lifecycle method GetAgency

Parameters

Parameter Direction Type Max length Description
:agencyId Input long N/A Method argument of GetAgency

Tables

Table Access Columns used
Agency SELECT agency_seq_num, agency_name, agency_eff_date, agency_exp_date, policy_holder_paperless_flag, agency_paperless_flag, agency_paperless_request_flag, update_date, update_user, agency_rep_user

LINQ statement

Source: Services/SAIF.Services/Agencies/Imaging/ImageService.cs:247.

// Services/SAIF.Services/Agencies/Imaging/ImageService.cs:247
return unitOfWork.GetRepository<agenciesDataModel.Agency>().Query().SingleOrDefault(a => a.Id == agencyId);

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
  A.agency_seq_num,
  A.agency_name,
  A.agency_eff_date,
  A.agency_exp_date,
  A.policy_holder_paperless_flag,
  A.agency_paperless_flag,
  A.agency_paperless_request_flag,
  A.update_date,
  A.update_user,
  A.agency_rep_user
FROM Agency A
WHERE A.agency_seq_num = :agencyId
-- NHibernate expects at most one row

Translation notes: - SAIFRepresentative (References → agency_rep_user) is selected as an FK only; the WcisEmployee table is not joined. HasMany collections (Contracts, Agents, TeamFunctions, DocumentNotifications) are lazy and not selected.

Operations and processes

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Services/SAIF.Services/Agencies/Imaging/ImageService.cs (L247)