Share via


EntityExtensions.GetRelatedEntity<TEntity, TResult> Method (TEntity, Expression<Func<TEntity, TResult>>)

 

Applies To: Dynamics CRM 2015

Retrieves the related entity for a specific relationship.

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

Syntax

public static TResult GetRelatedEntity<TEntity, TResult>(
    this TEntity entity,
    Expression<Func<TEntity, TResult>> relationshipSelector
)
where TEntity : Entity
where TResult : Entity
public:
generic<typename TEntity, typename TResult>
where TEntity : Entity
where TResult : Entity
[ExtensionAttribute]
static TResult GetRelatedEntity(
    TEntity entity,
    Expression<Func<TEntity, TResult>^>^ relationshipSelector
)
static member GetRelatedEntity<'TEntity, 'TResult when 'TEntity : Entity when 'TResult : Entity> : 
        entity:'TEntity *
        relationshipSelector:Expression<Func<'TEntity, 'TResult>> -> 'TResult
<ExtensionAttribute>
Public Shared Function GetRelatedEntity(Of TEntity As Entity, TResult As Entity) (
    entity As TEntity,
    relationshipSelector As Expression(Of Func(Of TEntity, TResult))
) As TResult

Parameters

  • entity
    Type: TEntity

    Type: Entity. The entity instance.

Return Value

Type: TResult

Type: Entity
The related entity for a specific relationship.

Type Parameters

  • TEntity
    The type, where TEntity is an Entity.
  • TResult

Remarks

Extends the core GetRelatedEntity<TEntity> method.

See Also

GetRelatedEntity Overload
EntityExtensions Class
Microsoft.Xrm.Client Namespace

Return to top

© 2017 Microsoft. All rights reserved. Copyright