Entity.GetRelatedEntity 方法

应用到: CRM 2015 on-prem, CRM Online

Gets the related entity instance for the specified relationship.

命名空间: Microsoft.Xrm.Sdk
程序集: Microsoft.Xrm.Sdk (在 Microsoft.Xrm.Sdk.dll 中)

语法

声明
Protected Overridable Function GetRelatedEntity(Of TEntity As Entity) ( _
    relationshipSchemaName As String, _
    primaryEntityRole As Nullable(Of EntityRole) _
) As TEntity
protected virtual TEntity GetRelatedEntity<TEntity> (
    string relationshipSchemaName,
    Nullable<EntityRole> primaryEntityRole
) where TEntity : Entity

GenericParameters

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

参数

  • relationshipSchemaName
    Type: 字符串. The name of the relationship.
  • primaryEntityRole
    Type: EntityRole. The role of the primary entity in the relationship (referenced or referencing).

返回值

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

示例

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

线程安全性

此类型的所有公共静态(Visual Basic 中的 Shared)成员都是线程安全成员。不保证任何实例成员是线程安全成员。

平台

开发平台

Windows Vista、Windows Server 2003 和

目标平台

Windows Vista,Windows XP

Change History

另请参阅

参考

Entity 类
Entity 成员
Microsoft.Xrm.Sdk 命名空间

Send comments about this topic to Microsoft.
© 2014 Microsoft Corporation. All rights reserved.