Entity.GetRelatedEntity<TEntity> Method (String, Nullable<EntityRole>)

 

Applies To: Dynamics CRM 2015

Gets the related entity instance for the specified relationship.

Namespace:   Microsoft.Xrm.Sdk
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)

Syntax

protected virtual TEntity GetRelatedEntity<TEntity>(
    string relationshipSchemaName,
    Nullable<EntityRole> primaryEntityRole
)
where TEntity : Entity
protected:
generic<typename TEntity>
where TEntity : Entity
virtual TEntity GetRelatedEntity(
    String^ relationshipSchemaName,
    Nullable<EntityRole> primaryEntityRole
)
abstract GetRelatedEntity<'TEntity when 'TEntity : Entity> : 
        relationshipSchemaName:string *
        primaryEntityRole:Nullable<EntityRole> -> 'TEntity
override GetRelatedEntity<'TEntity when 'TEntity : Entity> : 
        relationshipSchemaName:string *
        primaryEntityRole:Nullable<EntityRole> -> 'TEntity
Protected Overridable Function GetRelatedEntity(Of TEntity As Entity) (
    relationshipSchemaName As String,
    primaryEntityRole As Nullable(Of EntityRole)
) As TEntity

Parameters

Return Value

Type: TEntity

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

Type Parameters

  • TEntity
    Type: Entity. The type of the entity.

Examples

GetRelatedEntity<Account>("account_primary_contact", null);

See Also

Entity Class
Microsoft.Xrm.Sdk Namespace

Return to top

© 2016 Microsoft. All rights reserved. Copyright