Skip to content

SQL-212: ProviderQueryProvider.GetWorkingProviderRelationshipsByParentLocation

This statement is a read operation invoked through ORM (NHibernate LINQ). Executed by ProviderQueryProvider.GetWorkingProviderRelationshipsByParentLocation.

Classification

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

Parameters

Parameter Direction Type Max length Description
providerLocationId Input long N/A Method argument of ProviderQueryProvider.GetWorkingProviderRelationshipsByParentLocation bound into the ORM expression; NHibernate generates the bind variable at runtime
includeExpired Input bool N/A Method argument of ProviderQueryProvider.GetWorkingProviderRelationshipsByParentLocation bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
PROVIDER_RELATIONSHIP SELECT PROVIDER_LOCATION_SEQ_NUM, PARENT_PROVIDER_LOC_SEQ_NUM, EFF_DATE, UPDATE_NUM, EXP_DATE, UPDATE_DATE, UPDATE_USER, PROVIDER_RELATIONSHIP_CODE

LINQ statement

Source: Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:185-190.

//WRK
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1026:DefaultParametersShouldNotBeUsed")]
public IEnumerable<ProviderRelationship> GetWorkingProviderRelationshipsByParentLocation(long providerLocationId,
    DateTime serviceDate, bool includeExpired = false)
{
    return Factory.GetRepository<ProviderRelationship>().Query()
        .Where(r =>
            r.Relationship.Code == WorkingRelationship &&
            r.ParentProviderLocation.Id == providerLocationId
               && (includeExpired || r.ExpirationDate == null)
          ).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
SELECT
  PR.PROVIDER_LOCATION_SEQ_NUM,
  PR.PARENT_PROVIDER_LOC_SEQ_NUM,
  PR.EFF_DATE,
  PR.UPDATE_NUM,
  PR.EXP_DATE,
  PR.UPDATE_DATE,
  PR.UPDATE_USER,
  PR.PROVIDER_RELATIONSHIP_CODE
FROM PROVIDER_RELATIONSHIP PR
WHERE PR.PROVIDER_RELATIONSHIP_CODE = 'WRK'
  AND PR.PARENT_PROVIDER_LOC_SEQ_NUM = :providerLocationId
  AND (:includeExpired = 1 OR PR.EXP_DATE IS NULL)

Translation notes: - WorkingRelationship is the constant "WRK" (line 17). - The serviceDate parameter is accepted but never used in the predicate. - EFF_DATE is both a key property (line 16) and a plain Map (line 22); it is selected once. - includeExpired is a captured bool; see SQL-207 for the constant-folding note.

Operations and processes

Business rules

Sources

  • Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:185