Freigeben über


Entity.SetRelatedEntity<TEntity> Method

Definition

Sets the related entity instance for the specified relationship.

protected:
generic <typename TEntity>
 where TEntity : Microsoft::Xrm::Sdk::Entity virtual void SetRelatedEntity(System::String ^ relationshipSchemaName, Nullable<Microsoft::Xrm::Sdk::EntityRole> primaryEntityRole, TEntity entity);
protected virtual void SetRelatedEntity<TEntity> (string relationshipSchemaName, Microsoft.Xrm.Sdk.EntityRole? primaryEntityRole, TEntity entity) where TEntity : Microsoft.Xrm.Sdk.Entity;
abstract member SetRelatedEntity : string * Nullable<Microsoft.Xrm.Sdk.EntityRole> * 'Entity -> unit (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)
override this.SetRelatedEntity : string * Nullable<Microsoft.Xrm.Sdk.EntityRole> * 'Entity -> unit (requires 'Entity :> Microsoft.Xrm.Sdk.Entity)
Protected Overridable Sub SetRelatedEntity(Of TEntity As Entity) (relationshipSchemaName As String, primaryEntityRole As Nullable(Of EntityRole), entity As TEntity)

Type Parameters

TEntity

The type of the entity.

Parameters

relationshipSchemaName
String

The schema name of the relationship.

primaryEntityRole
Nullable<EntityRole>

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

entity
TEntity

The entity instance to set.

Examples

SetRelatedEntity<mbs_project>("mbs_project_workiem", null, value);

Applies to