共用方式為


OrganizationServiceContextExtensions.AddRelatedObject 方法 (OrganizationServiceContext, Entity, String, Entity, Nullable)

適用於: Microsoft Dynamics CRM 2015, Microsoft Dynamics CRM Online

命名空間: Microsoft.Xrm.Client
組件: Microsoft.Xrm.Client (在 Microsoft.Xrm.Client.dll 中)

使用方式

'用途
Dim context As OrganizationServiceContext
Dim source As Entity
Dim relationshipSchemaName As String
Dim target As Entity
Dim primaryEntityRole As Nullable(Of EntityRole)

OrganizationServiceContextExtensions.AddRelatedObject(context, source, relationshipSchemaName, target, primaryEntityRole)

語法

'宣告
<ExtensionAttribute> _
Public Shared Sub AddRelatedObject ( _
    context As OrganizationServiceContext, _
    source As Entity, _
    relationshipSchemaName As String, _
    target As Entity, _
    <OptionalAttribute> Optional primaryEntityRole As Nullable(Of EntityRole) = Nothing _
)
[ExtensionAttribute] 
public static void AddRelatedObject (
    OrganizationServiceContext context,
    Entity source,
    string relationshipSchemaName,
    Entity target,
    [OptionalAttribute] Nullable<EntityRole> primaryEntityRole
)

參數

  • source
    Type: Entity. The source entity instance.
  • relationshipSchemaName
    Type: 字串. The schema name of the relationship.
  • target
    Type: Entity. The target entity instance.
  • primaryEntityRole
    Type: Nullable<EntityRole>. The role that the entity plays in the relationship, referencing or referenced.

備註

This is an extension to the core AddRelatedObject method.

執行緒安全

此類型的任何公用靜態 (Visual Basic 中的 Shared) 成員都具備執行緒安全。任何執行個體成員都不保證具備執行緒安全。

平台

Development Platforms

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

Target Platforms

Windows Server 2008、Windows Server 2012、Windows 7

請參閱

參照

OrganizationServiceContextExtensions 類別
OrganizationServiceContextExtensions 成員
Microsoft.Xrm.Client 命名空間

其他資源

Developer Extensions for Microsoft Dynamics CRM
Access Entity Relationships

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