---
title: "SQL-200: ProviderQueryProvider.GetProviderAddressLastUpdateDate"
summary: Read operation for `ProviderQueryProvider.GetProviderAddressLastUpdateDate`
status: draft
owner: SAIF.Core documentation team
last_reviewed: 2026-09-24
library: SAIF.Data
reference_type: package
---

# 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](../database-tables.md#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`.

```csharp
// 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.

```sql
-- 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

- [Provider queries](../operations/provider-queries.md)

## Business rules

- [SD-BR-080 Provider identity relationship and address code sets](../business-rules.md#sd-br-080-provider-identity-relationship-and-address-code-sets)
- [SD-BR-082 Dismissed bills excluded from provider location ids](../business-rules.md#sd-br-082-dismissed-bills-excluded-from-provider-location-ids)
- [SD-BR-083 Provider in MCO only within date window](../business-rules.md#sd-br-083-provider-in-mco-only-within-date-window)

## Sources
- `Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:35`
