Skip to content

SQL-278: Retrieve ProviderLocation

This statement retrieves a single ProviderLocation by its identifier via NHibernate LINQ, used to resolve the process server, registered agent, and recipient provider locations while saving a subpoena in SubpoenaSaveService.SetSubpoenaData and SubpoenaSaveService.SaveRecipients, executed from Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L183, L236, L241).

Classification

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

Parameters

Parameter Direction Type Max length Description
:LocationId Input long N/A subpoena.ProcessServerId (L184) / subpoenaRecipient.RegisteredAgentLocationId (L237) / subpoenaRecipient.ProviderLocationId (L242) — matched against PROVIDER_LOCATION_SEQ_NUM

Tables

Table Access Columns used
PROVIDER_LOCATION SELECT PROVIDER_LOCATION_SEQ_NUM, UPDATE_NUM, BUSINESS_NAME, PAYEE_NAME, PRIMARY_LOCATION_FLAG, BUSINESS_FLAG, PHONE_AREA_CODE, PHONE_NUM, PHONE_NUM_EXT, TOLL_FREE_PHONE_NUM, FAX_NUM, LAST_NAME, FIRST_NAME, MIDDLE_NAME, PROVIDER_TYPE_CODE, PROVIDER_SEQ_NUM

LINQ statement

Source: Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:183

// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:183-184
dataSubpoena.ProcessServerLocation = _unitOfWork.GetRepository<ProviderData.ProviderLocation>()
    .Query().SingleOrDefault(x => x.Id == subpoena.ProcessServerId);

// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:236-237
dataRecipient.RegisteredAgentLocation = _unitOfWork.GetRepository<ProviderData.ProviderLocation>()
    .Query().SingleOrDefault(x => x.Id == subpoenaRecipient.RegisteredAgentLocationId);

// Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs:241-242
dataRecipient.ProviderLocation = _unitOfWork.GetRepository<ProviderData.ProviderLocation>()
    .Query().SingleOrDefault(x => x.Id == subpoenaRecipient.ProviderLocationId);

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
  PL.PROVIDER_LOCATION_SEQ_NUM,
  PL.UPDATE_NUM,
  PL.BUSINESS_NAME,
  PL.PAYEE_NAME,
  PL.PRIMARY_LOCATION_FLAG,
  PL.BUSINESS_FLAG,
  PL.PHONE_AREA_CODE,
  PL.PHONE_NUM,
  PL.PHONE_NUM_EXT,
  PL.TOLL_FREE_PHONE_NUM,
  PL.FAX_NUM,
  PL.LAST_NAME,
  PL.FIRST_NAME,
  PL.MIDDLE_NAME,
  PL.PROVIDER_TYPE_CODE,
  PL.PROVIDER_SEQ_NUM
FROM PROVIDER_LOCATION PL
WHERE PL.PROVIDER_LOCATION_SEQ_NUM = :LocationId
-- NHibernate expects at most one row

Translation notes: - L236/L241 run once per recipient inside the foreach (L221). - Single/SingleOrDefault → no row limit; NHibernate throws if more than one row is returned. - HasMany collections (Addresses, Identities, ProviderServices) are lazy; References(ProviderType)/References(Provider) contribute FK columns only.

Operations and processes

Sources

  • Services/SAIF.Services/Legal/Subpoenas/SubpoenaSaveService.cs (L183, L236, L241)