Skip to content

SQL-213: ProviderQueryProvider.GetExpiredRelationshipsOnOrAfterDate

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

Classification

Field Value
SQL ID SQL-213
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 GetExpiredRelationshipsOnOrAfterDate

Parameters

Parameter Direction Type Max length Description
effectiveDate Input DateTime N/A Method argument of ProviderQueryProvider.GetExpiredRelationshipsOnOrAfterDate 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:196-200.

public IEnumerable<ProviderRelationship> GetExpiredRelationshipsOnOrAfterDate(DateTime effectiveDate)
{
    return Factory.GetRepository<ProviderRelationship>().Query()
        .Where(r =>
            r.Relationship.Code == WorkingRelationship &&
            r.ExpirationDate != null &&
            r.UpdateDate >= effectiveDate).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.EXP_DATE IS NOT NULL
  AND PR.UPDATE_DATE >= :effectiveDate

Translation notes: - The parameter is named effectiveDate, but it filters on UPDATE_DATE, not EFF_DATE.

Operations and processes

Business rules

Sources

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