---
title: clsProviderAddressCollection
summary: API reference for clsProviderAddressCollection.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-07-24
library: SAIF.Business.View.Provider
reference_type: package
---

# clsProviderAddressCollection

API reference for clsProviderAddressCollection.

## Purpose
- Collection wrapper (`clsBusinessCollection(Of clsProviderAddress)`) that retrieves the set of addresses for a provider.
- Nested `Criteria` implements `IBusinessCriteria` and supplies its own `RetrieveSQL`.

## Context
- Namespace: `SAIF.Business.View.Provider`
- Assembly/package: `SAIF.BOF.Business.View.Provider`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| ActiveDate | `Property ActiveDate() As Date` (Protected set) | Gets the reference date used by `ActiveAddresses()`/`PrimaryAddress` calculations; set internally when `ActiveAddresses(activeDate)` is called. |
| ProviderLocationID | `ReadOnly Property ProviderLocationID() As Decimal` | Returns the provider location whose addresses this collection holds. |
| Item(inProviderLocationID) | `Default Overloads ReadOnly Property Item(ByVal inProviderLocationID As Decimal) As clsProviderAddress` | Returns the first address in the list whose `ProviderLocationID` matches the supplied value, or `Nothing`. |
| MyCriteria | `ReadOnly Property MyCriteria() As Criteria` | Returns the object's `Criteria` instance, strongly typed from `CriteriaObject`. |
| ActiveAddresses() | `Function ActiveAddresses() As clsProviderAddressCollection` | Returns the addresses active as of `Now` (delegates to `ActiveAddresses(Now)`). |
| ActiveAddresses(activeDate) | `Function ActiveAddresses(ByVal activeDate As Date) As clsProviderAddressCollection` | Returns the addresses whose `StartDate`/`TerminationDate` range includes `activeDate`, with `ActiveDate` set on the returned collection. |
| CorrespondenceAddress | `ReadOnly Property CorrespondenceAddress() As clsProviderAddress` | Returns the calculated primary correspondence address (falls back to the physical address if none is coded as correspondence). |
| PhysicalAddress | `ReadOnly Property PhysicalAddress() As clsProviderAddress` | Returns the calculated primary physical address (falls back to correspondence if none is coded as physical). |
| PaymentAddress | `ReadOnly Property PaymentAddress() As clsProviderAddress` | Returns the calculated primary payment address (falls back to physical, then correspondence). |
| PrimaryAddress(addressType) | `ReadOnly Property PrimaryAddress(ByVal addressType As AddressTypes) As clsProviderAddress` | Returns the calculated primary address for the given `AddressTypes` value, applying the same fallback rules as the type-specific properties. |
| Add | `Shadows Function Add(ByVal inProviderAddress As clsProviderAddress) As Integer` | Adds an address to the collection through the BOF base implementation. |
| Contains(inProviderAddress) | `Overloads Function Contains(ByVal inProviderAddress As clsProviderAddress) As Boolean` | Returns whether the active list contains an address equal to `inProviderAddress`. |
| Contains(inProviderLocationID) | `Overloads Function Contains(ByVal inProviderLocationID As Decimal) As Boolean` | Returns whether the active list contains an address whose `ProviderLocationID` matches (compared via `clsProviderAddress.Equals(Decimal)`). |
| ContainsDeleted(inProviderAddress) | `Overloads Function ContainsDeleted(ByVal inProviderAddress As clsProviderAddress) As Boolean` | Returns whether the deleted-items list contains an address equal to `inProviderAddress`. |
| ContainsDeleted(inProviderLocationID) | `Overloads Function ContainsDeleted(ByVal inProviderLocationID As Decimal) As Boolean` | Returns whether the deleted-items list contains an address whose `ProviderLocationID` matches. |
| Remove(inProviderAddress) | `Shadows Sub Remove(ByVal inProviderAddress As clsProviderAddress)` | Removes the supplied address instance directly from the underlying list. |
| Remove(inProviderLocationID) | `Shadows Sub Remove(ByVal inProviderLocationID As Decimal)` | Removes the first address whose `ProviderLocationID` matches the supplied value. |
| Save() | `Overrides Function Save() As Boolean` | Applies the pending edit transaction, then persists the collection through the BOF base `Save()`. |
| GetProviderAddressCollection | `Shared Function GetProviderAddressCollection(ByVal inDataportal As IDataPortalInfo, ByVal inProviderLocationID As Decimal) As clsProviderAddressCollection` | Retrieves all addresses for the given provider location through [SQL-005](../../sql/SQL-005-saif-business-view-provider.md) (the `clsProviderAddress` retrieve SQL, parameterized by `ProviderLocationID`). |

## Behavioral notes
- `BeforeRetrieve` builds the data request from `MyCriteria.RetrieveSQL` (the shared `clsProviderAddress.RETRIEVE_SQL`) parameterized by `ProviderLocationID`; `AfterRetrieve` loads each row into a new `clsProviderAddress(m_ProviderLocationID)` via `Load(...)` and adds it to the base list.
- The nested `Criteria` throws `ApplicationException` from `CreateSQL`, `InsertSQL`, `UpdateSQL`, and `DeleteSQL` — the collection is retrieve-only for new-row creation, even though `Save()` is overridden to apply pending edits to already-loaded members.
- `CalculatePrimaryAddress`/`FilterAddress` are `Private` helpers backing the `CorrespondenceAddress`/`PhysicalAddress`/`PaymentAddress`/`PrimaryAddress` properties; they are not part of the public surface.

## Constraints and usage notes
- Instances are constructed only through `GetProviderAddressCollection(...)`; the `Protected` constructor (which sets `AllowEdit`/`AllowRemove`/`AllowSort`/`AllowFind` to `True`) is not part of the public surface.

## Inherited members (from clsBusinessCollectionBase via clsBusinessCollection(Of T))

This collection type inherits the following public surface from clsBusinessCollectionBase (`Legacy\BusinessObjectFramework\clsBusinessCollectionBase.vb`), in addition to the members listed above:

| Member | Signature | Purpose |
| --- | --- | --- |
| Item | `Default Public ReadOnly Property Item(ByVal index As Integer) As clsBusinessBase` | Returns the collection member at the given index (default indexer). |
| Add | `Sub Add(ByVal inChild As clsBusinessBase)` | Adds a child business object to the collection. |
| Remove | `Sub Remove(ByVal inChild As clsBusinessBase)` | Marks a child business object as deleted and removes it from the active list. |
| ItemByGuid | `ReadOnly Property ItemByGuid(ByVal inGuid As String) As clsBusinessBase` | Returns the collection member matching the given internal GUID. |
| MyGuid | `ReadOnly Property MyGuid() As String` | Returns the internal GUID that uniquely identifies this in-memory collection instance. |
| IsDirty | `ReadOnly Property IsDirty() As Boolean` | Indicates whether the collection or any child member has unsaved changes. |
| IsValid | `Overridable ReadOnly Property IsValid() As Boolean` | Indicates whether all child members currently have no broken validation rules. |
| ValidateAllChildren | `Overridable Property ValidateAllChildren() As Boolean` | Controls whether every child is validated or only the current item. |
| Rules | `ReadOnly Property Rules() As clsRulesManager` | Returns the rules manager that tracks broken rules for the collection. |
| ErrorCount / ErrorMessages | `ReadOnly Property ErrorCount() As Integer` / `ReadOnly Property ErrorMessages() As String()` | Returns the count and text of broken error-severity rules across the collection. |
| WarningCount / WarningMessages | `ReadOnly Property WarningCount() As Integer` / `ReadOnly Property WarningMessages() As String()` | Returns the count and text of broken warning-severity rules across the collection. |
| InformationalCount / InformationalMessages | `ReadOnly Property InformationalCount() As Integer` / `ReadOnly Property InformationalMessages() As String()` | Returns the count and text of broken informational-severity rules across the collection. |
| BeginEdit / CancelEdit / ApplyEdit | `Sub BeginEdit()` / `Sub CancelEdit()` / `Sub ApplyEdit()` | Begins, rolls back, or commits an edit transaction across the collection. |
| SaveChild | `Overridable Function SaveChild() As Boolean` | Persists the collection as a child of a parent object. |
| Clone | `Function Clone() As Object` | Returns a deep copy of the collection and its members. |
| IsManaged | `ReadOnly Property IsManaged() As Boolean` | Indicates whether the collection is managed by a parent object's lifecycle. |
| First / FirstItem | `Function First() As clsBusinessBase` / `ReadOnly Property FirstItem() As clsBusinessBase` | Moves to and/or returns the first item in traversal order. |
| Next / NextItem | `Function [Next]() As clsBusinessBase` / `ReadOnly Property NextItem() As clsBusinessBase` | Moves to and/or returns the next item in traversal order. |
| Previous / PreviousItem | `Function Previous() As clsBusinessBase` / `ReadOnly Property PreviousItem() As clsBusinessBase` | Moves to and/or returns the previous item in traversal order. |
| Last / LastItem | `Function Last() As clsBusinessBase` / `ReadOnly Property LastItem() As clsBusinessBase` | Moves to and/or returns the last item in traversal order. |
| CurrentIndex | `ReadOnly Property CurrentIndex() As Integer` | Returns the index of the current traversal item. |
| SetCurrent | `Sub SetCurrent(ByRef inObject As clsBusinessBase)` / `Sub SetCurrent(ByVal inIndex As Integer)` | Sets the current traversal position by item or index. |
| IndexOf | `ReadOnly Property IndexOf(ByVal inObject As clsBusinessBase) As Integer` | Returns the index of the given item within the collection. |
| IsFirst / IsNext / IsLast / IsPrevious / IsCurrent | `ReadOnly Property IsFirst(ByVal inItem As clsBusinessBase) As Boolean` (and analogous overloads) | Indicate an item's position relative to the current traversal state. |
| XMLElementName / XMLItemName | `Property XMLElementName() As String` / `Property XMLItemName() As String` | Get or set the XML element/item names used when serializing the collection. |
| GetReportXML | `Function GetReportXML(ByVal inElementName As String) As String` (and file-stream overload) | Returns an XML fragment representing the collection and its members. |
| ToXML / ToXml | `Function ToXML() As String` / `Function ToXml(ByVal inTagName As String) As String` | Serializes the collection to XML using the default or a supplied tag name. |

## Sources
- `Business\SAIF.Business.View.Provider\clsProviderAddressCollection.vb`
