Skip to content

SQL-077: Retrieve Agency via GenerateDirectWriterNotifications

This ORM statement performs a read operation on Agency via GenerateDirectWriterNotifications, executed from Services/SAIF.Services/OutputDocuments/PolicyDocumentsBatchService.cs (L253).

Classification

Field Value
SQL ID SQL-077
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 GenerateDirectWriterNotifications

Parameters

Parameter Direction Type Max length Description
(none) N/A N/A N/A No bind parameters

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/OutputDocuments/PolicyDocumentsBatchService.cs:253.

// Services/SAIF.Services/OutputDocuments/PolicyDocumentsBatchService.cs:253
var agency = unitOfWork.GetRepository<Agency>().Query().SingleOrDefault(a => a.Id == Agency.SaifAgencyId);

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 = 0
-- NHibernate expects at most one row

Translation notes: - Agency.SaifAgencyId is public const long SaifAgencyId = 0; (Data/SAIF.Data/Model/Agencies/Agency.cs:10); a C# const is compiled into the expression tree as a constant, so it is written inline as the literal 0 (NHibernate may still send it as a bind parameter). - agency.IsPaperlessForPolicyHolderCopyOfDocuments is tested in memory after materialization (line 255). - 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/OutputDocuments/PolicyDocumentsBatchService.cs (L253)