Skip to content

SQL-048: ProvidersRepository.GetProviderByTaxIdBatch

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

Classification

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

Parameters

Parameter Direction Type Max length Description
:taxId Input string N/A Method argument bound into the LINQ expression

Tables

Table Access Columns used
PROVIDER SELECT PROVIDER_SEQ_NUM, UPDATE_NUM, PRIMARY_TAX_ID, UPDATE_DATE, UPDATE_USER

LINQ statement

Source: Data/SAIF.Data.NHibernate/Repositories/ProvidersRepository.cs:20.

public Provider GetProviderByTaxIdBatch(string taxId)
{
    return unitOfWork.GetRepository<Provider>().Query()
        .SingleOrDefault(pr => pr.PrimaryTaxId == taxId);
}

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_SEQ_NUM,
  PR.UPDATE_NUM,
  PR.PRIMARY_TAX_ID,
  PR.UPDATE_DATE,
  PR.UPDATE_USER
FROM PROVIDER PR
WHERE PR.PRIMARY_TAX_ID = :taxId
-- NHibernate expects at most one row

Translation notes: - SingleOrDefault throws in memory if more than one provider shares the tax id; no row limit is emitted. - Dialect caveat: ProvidersRepository has no DI registration or new ProvidersRepository(...) usage found anywhere in the repository, so the call-site dialect cannot be proven from wiring. The only NHibernate configuration factory available to this assembly is the Oracle one (OracleConfigurationFactory = OracleDataClientConfiguration.Oracle10), so Oracle is assumed rather than confirmed. - Provider.Locations / Provider.TaxIds (HasMany) are lazy and not touched by this query.

Operations and processes

Business rules

Note: Statements marked with ** could not be confirmed; treat as unknown until verified.

Sources

  • Data/SAIF.Data.NHibernate/Repositories/ProvidersRepository.cs:20