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

# clsProviderRelationship

API reference for clsProviderRelationship.

## Purpose
- Business object representing a directional relationship between two provider locations (parent/child), as returned by `clsProviderRelationshipCollection`.
- Nested `Criteria` implements `IBusinessCriteria`, but every SQL property (`CreateSQL`, `RetrieveSQL`, `InsertSQL`, `UpdateSQL`, `DeleteSQL`) throws `ApplicationException` — the object is always loaded from a reader row supplied by its owning collection, never retrieved independently.

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

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| SourceProviderLocationIsParent | `ReadOnly Property SourceProviderLocationIsParent() As Boolean` | Returns whether `SourceRelationshipType` equals `clsProviderRelationshipCollection.RelationshipTypes.Parent`. |
| DestinationProviderLocationIsParent | `ReadOnly Property DestinationProviderLocationIsParent() As Boolean` | Returns whether `DestinationRelationshipType` equals `clsProviderRelationshipCollection.RelationshipTypes.Parent`. |
| BusinessName | `ReadOnly Property BusinessName() As String` | Returns `DestinationProviderLocation.BusinessName`. |
| WorksForDescription | `ReadOnly Property WorksForDescription() As String` | Returns a formatted string of the destination location's ID and business name, appending `" - Exp. <date>"` when `TerminationDate` is set. |
| IsActive | `ReadOnly Property IsActive() As Boolean` | Returns whether `Date.Now` falls between `StartDate` and `TerminationDate` (or `Date.MaxValue` if no termination date is set). |
| ParentProviderLocationID | `ReadOnly Property ParentProviderLocationID() As Decimal` | Returns the parent provider location identifier for this relationship. |
| ChildProviderLocationID | `ReadOnly Property ChildProviderLocationID() As Decimal` | Returns the child provider location identifier for this relationship. |
| SourceRelationshipType | `ReadOnly Property SourceRelationshipType() As clsProviderRelationshipCollection.RelationshipTypes` | Returns whether the location the collection was queried against (`SourceProviderLocation`) is the parent or child side of the relationship. |
| DestinationRelationshipType | `ReadOnly Property DestinationRelationshipType() As clsProviderRelationshipCollection.RelationshipTypes` | Returns the opposite of `SourceRelationshipType` (the "other side" of the relationship). |
| SourceProviderLocation | `ReadOnly Property SourceProviderLocation() As clsProviderLocation` | Returns `ParentProviderLocation` or `ChildProviderLocation` depending on `SourceRelationshipType`. |
| DestinationProviderLocation | `ReadOnly Property DestinationProviderLocation() As clsProviderLocation` | Returns `ChildProviderLocation` or `ParentProviderLocation` depending on `DestinationRelationshipType`. |
| ChildProviderLocation | `ReadOnly Property ChildProviderLocation() As clsProviderLocation` | Returns the already-loaded destination location directly when the destination is the child; otherwise lazily retrieves it via `clsProviderLocation.GetProviderLocation(...)` by `ChildProviderLocationID`. |
| ParentProviderLocation | `ReadOnly Property ParentProviderLocation() As clsProviderLocation` | Returns the already-loaded destination location directly when the destination is the parent; otherwise lazily retrieves it via `clsProviderLocation.GetProviderLocation(...)` by `ParentProviderLocationID`. |
| ProviderRelationshipCode | `ReadOnly Property ProviderRelationshipCode() As String` | Returns the code describing how the parent and child locations are related. |
| StartDate | `ReadOnly Property StartDate() As Date` | Returns the date this relationship started. |
| TerminationDate | `ReadOnly Property TerminationDate() As Date` | Returns the date this relationship was terminated (from the internal `clsSmartDate`). |
| MyCriteria | `ReadOnly Property MyCriteria() As Criteria` | Returns the object's `Criteria` instance, strongly typed from `CriteriaObject`. |
| Equals(objA, objB) | `Overloads Shared Function Equals(ByVal objA As Object, ByVal objB As Object) As Boolean` | Returns whether both objects are `clsProviderRelationship` instances with equal `ChildProviderLocationID` values. |
| Equals(inObject As Object) | `Overloads Overrides Function Equals(ByVal inObject As Object) As Boolean` | Returns whether `inObject` is a `clsProviderRelationship` with an equal `ChildProviderLocationID`. |
| Equals(inObject As clsProviderRelationship) | `Overloads Function Equals(ByVal inObject As clsProviderRelationship) As Boolean` | Returns whether `inObject.ChildProviderLocationID` equals this instance's `ChildProviderLocationID`. |
| GetHashCode | `Overrides Function GetHashCode() As Integer` | Returns `ChildProviderLocationID.GetHashCode()`. |
| ToString | `Overrides Function ToString() As String` | Returns `ChildProviderLocationID` converted to a string. |

## Behavioral notes
- Instances are populated exclusively through the `Protected Friend Load(inDataPortalInfo, datareader, sourceRelationshipType)` method, called by `clsProviderRelationshipCollection`'s `AfterRetrieve`; there is no shared `Get...` retrieval function on this class itself.
- `Fill` both populates the relationship's own fields (`StartDate`, `TerminationDate`, `ParentProviderLocationID`, `ChildProviderLocationID`, `ProviderRelationshipCode`) and constructs/loads a full `clsProviderLocation` from the same reader row as `m_destinationProviderLocation`, avoiding a second round-trip for the destination location.
- `ChildProviderLocation`/`ParentProviderLocation` only issue a fresh `clsProviderLocation.GetProviderLocation(...)` call for the side of the relationship that was **not** already loaded as the destination location; the destination side is returned directly.

## Constraints and usage notes
- Instances are constructed only through the `Protected Friend` parameterless constructor together with `Load(...)`; there is no public `New` or shared retrieval function.
- The nested `Criteria` throws `ApplicationException` from all five `IBusinessCriteria` SQL properties (`CreateSQL`, `RetrieveSQL`, `InsertSQL`, `UpdateSQL`, `DeleteSQL`); it exists only to carry `DataPortalInfo`/`ProviderLocationID` context, not to execute SQL directly.

## Inherited members (from clsBusinessBase)

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

| Member | Signature | Purpose |
| --- | --- | --- |
| MyGuid | `ReadOnly Property MyGuid() As String` | Returns the internal GUID that uniquely identifies this in-memory object instance. |
| IsNew | `ReadOnly Property IsNew() As Boolean` | Indicates whether the object has not yet been persisted. |
| IsDeleted | `ReadOnly Property IsDeleted() As Boolean` | Indicates whether the object is marked for deletion. |
| IsDirty | `Overridable ReadOnly Property IsDirty() As Boolean` | Indicates whether the object (or a child) has unsaved changes. |
| IsValid | `Overridable ReadOnly Property IsValid() As Boolean` | Indicates whether the object currently has no broken validation rules. |
| ValidateOnDelete | `Property ValidateOnDelete As Boolean` | Controls whether validation rules run before a delete operation. |
| Rules | `ReadOnly Property Rules() As clsRulesManager` | Returns the rules manager that tracks broken rules for this object. |
| ErrorCount | `ReadOnly Property ErrorCount() As Integer` | Returns the number of broken error-severity rules. |
| ErrorMessages | `ReadOnly Property ErrorMessages() As String()` | Returns the text of all broken error-severity rules. |
| WarningCount | `ReadOnly Property WarningCount() As Integer` | Returns the number of broken warning-severity rules. |
| WarningMessages | `ReadOnly Property WarningMessages() As String()` | Returns the text of all broken warning-severity rules. |
| InformationalCount | `ReadOnly Property InformationalCount() As Integer` | Returns the number of broken informational-severity rules. |
| InformationalMessages | `ReadOnly Property InformationalMessages() As String()` | Returns the text of all broken informational-severity rules. |
| BeginEdit | `Sub BeginEdit()` | Begins an editable transaction, snapshotting current field values. |
| CancelEdit | `Sub CancelEdit()` | Rolls back field values to the last `BeginEdit` snapshot. |
| ApplyEdit | `Sub ApplyEdit()` | Commits the current edit transaction, discarding the rollback snapshot. |
| Delete | `Sub Delete()` | Marks the object for deletion on the next save. |
| Save | `Overridable Function Save() As Boolean` | Persists the object (insert, update, or delete) through the BOF data portal, if valid. |
| SaveChild | `Overridable Function SaveChild() As Boolean` | Persists the object as a child of a parent object/collection. |
| Clone | `Function Clone() As Object` | Returns a deep copy of the object. |
| XMLElementName | `Property XMLElementName() As String` | Gets or sets the XML element name used when serializing this object. |
| GetDataset | `Sub GetDataset(ByRef inDS As DataSet)` | Populates a `DataSet` with the object's field values. |
| GetDataset (named table) | `Sub GetDataset(ByRef inDS As DataSet, ByVal inTableName As String)` | Populates a `DataSet` table with the given name with the object's field values. |
| GetReportXML | `Function GetReportXML(ByVal inElementName As String) As String` | Returns an XML fragment representing the object using the supplied element name. |
| GetReportXML (default name) | `Function GetReportXML() As String` | Returns an XML fragment representing the object using the default XML element name. |
| ToXml | `Function ToXml() As String` | Serializes the object to XML using the default element name. |
| ToXml (named tag) | `Function ToXml(ByVal inTagName As String) As String` | Serializes the object to XML using the supplied tag name. |
| PreviousLinkItem / NextLinkItem | `ReadOnly Property PreviousLinkItem() As ILinkItem` / `ReadOnly Property NextLinkItem() As ILinkItem` | Returns the adjacent linked-list item for collection traversal. |
| SetValueOnChange | `Function SetValueOnChange(Of T)(ByRef inFieldValue As T, ByVal inSetValue As T, Optional ByVal inMarkDirty As Boolean = True) As Boolean` | Sets a backing field only when the value changes, optionally marking the object dirty. |

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