Skip to content

SQL-200: ProviderQueryProvider.GetProviderAddressLastUpdateDate

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

Classification

Field Value
SQL ID SQL-200
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 GetProviderAddressLastUpdateDate

Tables

Table Access Columns used
PROVIDER_ADDRESS SELECT (aggregate) UPDATE_USER, EXP_DATE (filters); UPDATE_DATE (MAX)

LINQ statement

Source: Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:35-36. The repository/queryable is initialised at Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:30.

// Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:30
_providerAddressRepository = Factory.GetRepository<ProviderAddress>().Query();

// Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:35-36
public DateTime GetProviderAddressLastUpdateDate()
{
    return _providerAddressRepository.Where(x => x.UpdateUser == "CMN0140"
        && x.ExpirationDate.IsNull()).Max(x => x.UpdateDate);
}

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 MAX(PA.UPDATE_DATE)
FROM PROVIDER_ADDRESS PA
WHERE PA.UPDATE_USER = 'CMN0140'
  AND PA.EXP_DATE IS NULL

Translation notes: - x.ExpirationDate.IsNull() is the SAIF.Framework.Common object extension, not a LINQ/NHibernate-known method. No custom ILinqToHqlGeneratorsRegistry/BaseHqlGeneratorForMethod is registered in this repository (grep across **/*.cs found none), and the Legends CLI lookup of IsNull in SAIF.Framework.Common documents no NHibernate LINQ generator. It is translated by intent as IS NULL. Version-dependent behavior: without a registered generator, NHibernate's LINQ provider may throw NotSupportedException at runtime instead of emitting this SQL. - Max over an empty set returns SQL NULL. Casting it to a non-nullable DateTime throws in NHibernate. The literal 'CMN0140' is shown inline.

Operations and processes

Business rules

Sources

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