ProvidersRepository¶
ProvidersRepository is the only repository in this library that is a plain class rather than a Repository<T>/RepositoryBase<T> subclass: it wraps a generic IUnitOfWork and calls unitOfWork.GetRepository<T>() per-entity-type instead of being bound to a single mapped entity. It offers provider lookup by tax id and address lookup filtered by address type, with GetProviderPaymentAddresses/GetProviderPhysicalAddresses hard-coding the "PAY"/"PHY" address-type codes (SDN-BR-031).
Purpose¶
- Look up a
Providerby its primary tax id for batch processing scenarios. - Return active (non-expired) provider addresses filtered by address type, with dedicated payment ("PAY") and physical ("PHY") address helpers (SDN-BR-031).
- Enforce that a non-null
IUnitOfWorkis supplied at construction, per SDN-BR-030.
Context¶
- Namespace:
SAIF.Data.NHibernate.Repositories - Assembly/package:
SAIF.Data.NHibernate(ships inside theSAIF.SAIFCode.CoreNuGet package) - No base class:
ProvidersRepositoryis a plain class, not aRepository<T>/RepositoryBase<T>subclass; it holds a privateIUnitOfWorkfield and callsunitOfWork.GetRepository<T>()per query. IUnitOfWorkis defined inSAIF.Framework.Data.NHibernate(external); its concrete implementation,NHibernateUnitOfWork, exposesGetRepository<TEntity>() : Repository<TEntity>which constructs a newRepository<TEntity>bound to the same session/transaction (resolved via Legends CLI)†.
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| ProvidersRepository(IUnitOfWork) | public ProvidersRepository(IUnitOfWork uow) |
Constructor; validates uow is non-null via Enforce.ArgumentNotNull (SAIF.Framework.Core), throwing if null, then stores it (SDN-BR-030). |
| GetProviderByTaxIdBatch | public Provider GetProviderByTaxIdBatch(string taxId) |
Returns the single Provider whose PrimaryTaxId equals taxId via unitOfWork.GetRepository<Provider>().Query().SingleOrDefault(), or null if none/ambiguous match throws (SQL-048). |
| GetProviderAddresses | public IEnumerable<ProviderAddress> GetProviderAddresses(long providerId, string addressType) |
Returns non-expired ProviderAddress rows for the given provider id and address-type code, materialized to a list, via unitOfWork.GetRepository<ProviderAddress>().Query() (SQL-049). |
| GetProviderPaymentAddresses | public IEnumerable<ProviderAddress> GetProviderPaymentAddresses(long providerId) |
Calls GetProviderAddresses(providerId, "PAY") to return the provider's payment addresses (SDN-BR-031). |
| GetProviderPhysicalAddresses | public IEnumerable<ProviderAddress> GetProviderPhysicalAddresses(long providerId) |
Calls GetProviderAddresses(providerId, "PHY") to return the provider's physical addresses (SDN-BR-031). |
Behavioral notes¶
GetProviderAddressesfilters onpa.ExpirationDate == null(address currently active) in addition toProviderLocation.Provider.Id == providerIdandAddressType.Code == addressType*.- Because this class does not derive from
Repository<T>, it has no CRUD surface of its own; all persistence access goes through per-callIUnitOfWork.GetRepository<TEntity>()calls, meaning each query obtains a freshRepository<TEntity>bound to the same underlying session/transaction as the injected unit of work†.
Constraints and usage notes¶
- The constructor throws (via
Enforce.ArgumentNotNull) ifuowis null; callers must supply a validIUnitOfWorkinstance (SDN-BR-030). GetProviderByTaxIdBatchusesSingleOrDefault, which throwsInvalidOperationExceptionif more than oneProvidershares the samePrimaryTaxId*.
Note: Statements marked with
†are derived from dependency library documentation via the Legends CLI. Statements marked with*were inferred from code structure or contextual evidence. Statements marked with**could not be confirmed; treat as unknown until verified.
Related documentation¶
- Index
- Overview
- Architecture
- Dependencies
- Operations and processes
- Business rules
- Database tables
- SQL catalog
- Procedures
- Security and authorization
- API reference
Sources¶
Data/SAIF.Data.NHibernate/Repositories/ProvidersRepository.cs