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

# clsProviderCollection

API reference for clsProviderCollection.

## Purpose
- Collection wrapper (`clsBusinessCollection(Of clsProvider)`) that retrieves and holds a set of `clsProvider` business objects.
- Nested `Criteria` implements `IBusinessCriteria` and supplies its own `RetrieveSQL` independent of the single-provider retrieval path.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| Item(Index) | `Default Shadows ReadOnly Property Item(ByVal Index As Integer) As clsProvider` | Return the provider at the supplied collection index. |
| Item(inProviderID) | `Default Shadows ReadOnly Property Item(ByVal inProviderID As Decimal) As clsProvider` | Return the provider whose `ProviderID` matches the supplied value, or `Nothing` if none matches. |
| CurrentItem | `Shadows ReadOnly Property CurrentItem() As clsProvider` | Return the current traversal item, strongly typed as `clsProvider`. |
| Add(inProvider) | `Shadows Function Add(ByVal inProvider As clsProvider) As Integer` | Add a provider to the collection through the BOF base implementation. |
| Contains(inProvider) | `Overloads Function Contains(ByVal inProvider As clsProvider) As Boolean` | Return whether the active (non-deleted) list contains a provider equal to `inProvider`. |
| Contains(inProviderID) | `Overloads Function Contains(ByVal inProviderID As Decimal) As Boolean` | Return whether the active (non-deleted) list contains a provider whose `ProviderID` matches the supplied value. |
| ContainsDeleted(inProvider) | `Overloads Function ContainsDeleted(ByVal inProvider As clsProvider) As Boolean` | Return whether the deleted-items list contains a provider equal to `inProvider`. |
| ContainsDeleted(inProviderID) | `Overloads Function ContainsDeleted(ByVal inProviderID As Decimal) As Boolean` | Return whether the deleted-items list contains a provider whose `ProviderID` matches the supplied value. |
| Remove(inProvider) | `Shadows Sub Remove(ByVal inProvider As clsProvider)` | Remove the supplied provider instance from the active list. |
| Remove(inProviderID) | `Shadows Sub Remove(ByVal inProviderID As Decimal)` | Remove the first provider whose `ProviderID` matches the supplied value. |
| Save() | `Overrides Function Save() As Boolean` | Apply the pending edit transaction, then persist the collection through the BOF base `Save()`. |
| GetProviderCollection(inDataportal, inPrimaryTaxIDs) | `Shared Function GetProviderCollection(ByVal inDataportal As IDataPortalInfo, ByVal inPrimaryTaxIDs As String()) As clsProviderCollection` | Retrieve the providers whose primary tax IDs are in the supplied array through [SQL-007](../../sql/SQL-007-saif-business-view-provider.md). |
| GetProvidersUsingWhere(inDataportal, inWhereClause) | `Shared Function GetProvidersUsingWhere(ByVal inDataportal As IDataPortalInfo, ByVal inWhereClause As String) As clsProviderCollection` | Retrieve providers using a caller-supplied `WHERE` clause appended to the base provider `SELECT` documented by [SQL-007](../../sql/SQL-007-saif-business-view-provider.md). |
| Where(match) | `Function Where(ByVal match As Predicate(Of clsProvider)) As clsProviderCollection` | Return a new `clsProviderCollection` containing only the members matching the supplied predicate. |

## Behavioral notes
- `BeforeRetrieve`/`AfterRetrieve` load each row into a new `clsProvider` via `Provider.Load(...)` and add it to the base list.
- Nested `Criteria` throws `ApplicationException` from `CreateSQL`, `InsertSQL`, `UpdateSQL`, and `DeleteSQL`, so the collection is retrieve-only for new-row creation even though `Save()` is overridden to apply pending edits to already-loaded members.

## Constraints and usage notes
- Instances are constructed only through `GetProviderCollection(...)` or `GetProvidersUsingWhere(...)`; the `Protected` constructor is not part of the public surface.
- The collection is configured with `allowedit = True`, `allowremove = True`, `allowsort = True`, `allowfind = True`, and `Managed = True`.

## 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); shadowed above by the strongly typed `clsProvider` overloads. |
| Add | `Sub Add(ByVal inChild As clsBusinessBase)` | Adds a child business object to the collection; shadowed above by the strongly typed `Add(inProvider)` overload. |
| Remove | `Sub Remove(ByVal inChild As clsBusinessBase)` | Marks a child business object as deleted and removes it from the active list; shadowed above by the strongly typed `Remove` overloads. |
| 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\clsProviderCollection.vb`
