Entity.GetRelatedEntities<TEntity> Method

Definition

Gets the collection of related entity instances for the specified relationship.

protected:
generic <typename TEntity>
 where TEntity : Microsoft::Xrm::Sdk::Entity virtual System::Collections::Generic::IEnumerable<TEntity> ^ GetRelatedEntities(System::String ^ relationshipSchemaName, Nullable<Microsoft::Xrm::Sdk::EntityRole> primaryEntityRole);
protected virtual System.Collections.Generic.IEnumerable<TEntity> GetRelatedEntities<TEntity> (string relationshipSchemaName, Microsoft.Xrm.Sdk.EntityRole? primaryEntityRole) where TEntity : Microsoft.Xrm.Sdk.Entity;
abstract member GetRelatedEntities : string * Nullable<Microsoft.Xrm.Sdk.EntityRole> -> seq<'Entity (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)> (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)
override this.GetRelatedEntities : string * Nullable<Microsoft.Xrm.Sdk.EntityRole> -> seq<'Entity (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)> (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)
Protected Overridable Function GetRelatedEntities(Of TEntity As Entity) (relationshipSchemaName As String, primaryEntityRole As Nullable(Of EntityRole)) As IEnumerable(Of TEntity)

Type Parameters

TEntity

Type: Entity. The type of the entity.

Parameters

relationshipSchemaName
String

Type: String. The schema name of the relationship.

primaryEntityRole
Nullable<EntityRole>

The role of the primary entity in the relationship (referenced or referencing).

Returns

IEnumerable<TEntity>

Type: IEnumerableThe collection of related entity instances for the specified relationship.

Examples

GetRelatedEntities<CampaignResponse>("activity_pointer_campaignresponse", null);

Applies to