Skip to content

SQL-211: ProviderQueryProvider.GetProviderIdentitiesByNpi

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

Classification

Field Value
SQL ID SQL-211
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 GetProviderIdentitiesByNpi

Parameters

Parameter Direction Type Max length Description
nationalProviderId Input string N/A Method argument of ProviderQueryProvider.GetProviderIdentitiesByNpi bound into the ORM expression; NHibernate generates the bind variable at runtime

Tables

Table Access Columns used
PROVIDER_IDENTITY SELECT PROVIDER_IDENTITY_SEQ_NUM, UPDATE_NUM, IDENTITY_VALUE, UPDATE_USER, UPDATE_DATE, PROVIDER_LOCATION_SEQ_NUM, PROVIDER_IDENTITY_CODE

LINQ statement

Source: Data/SAIF.Data/Queries/Providers/ProviderQueryProvider.cs:172-177.

public IEnumerable<ProviderIdentity> GetProviderIdentitiesByNpi(string nationalProviderId)
{
    string[] npiCodes = { NationalProviderId, OrganizationalNationalProviderId };

    return Factory.GetRepository<ProviderIdentity>()
        .Query()
        .Where(i =>
            i.Value.TrimEnd() == nationalProviderId &&
            npiCodes.Contains(i.IdentityType.Code))
        .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
  PI.PROVIDER_IDENTITY_SEQ_NUM,
  PI.UPDATE_NUM,
  PI.IDENTITY_VALUE,
  PI.UPDATE_USER,
  PI.UPDATE_DATE,
  PI.PROVIDER_LOCATION_SEQ_NUM,
  PI.PROVIDER_IDENTITY_CODE
FROM PROVIDER_IDENTITY PI
WHERE RTRIM(PI.IDENTITY_VALUE) = :nationalProviderId
  AND PI.PROVIDER_IDENTITY_CODE IN ('NPI', 'ONPI')

Translation notes: - TrimEnd() with no arguments → Oracle RTRIM(col). - Mapping quirk: the column is declared as "IDENTITY_VALUE " with a trailing space (ProviderIdentityMap.cs:16). The generated SQL would carry that spacing; it is normalized to IDENTITY_VALUE here. Oracle ignores the whitespace in an unquoted identifier. - npiCodes.Contains(x.Code) → IN (:p0, :p1). The values are shown inline.

Operations and processes

Business rules

Sources

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