CanBeReferencingRequest Kelas

Contains the data that is needed to check whether an entity can be the referencing entity in a one-to-many relationship.

Ruang nama: Microsoft.Xrm.Sdk.Messages
Perhimpunan: Microsoft.Xrm.Sdk (dalam Microsoft.Xrm.Sdk.dll)

public sealed class CanBeReferencingRequest : OrganizationRequest

The following example shows how to use this message. For this sample to work correctly, you must be connected to the server to get an IOrganizationService interface. For the complete sample, see the link later in this topic.

/// <summary>
/// Determines whether two entities are eligible to participate in a relationship
/// </summary>
/// <param name="referencedEntity">Primary Entity</param>
/// <param name="referencingEntity">Referencing Entity</param>
/// <returns></returns>
public bool EligibleCreateOneToManyRelationship(string referencedEntity, 
    string referencingEntity)
    //Checks whether the specified entity can be the primary entity in one-to-many
    CanBeReferencedRequest canBeReferencedRequest = new CanBeReferencedRequest
        EntityName = referencedEntity

    CanBeReferencedResponse canBeReferencedResponse =

    if (!canBeReferencedResponse.CanBeReferenced)
            "Entity {0} can't be the primary entity in this one-to-many relationship", 

    //Checks whether the specified entity can be the referencing entity in one-to-many
    CanBeReferencingRequest canBereferencingRequest = new CanBeReferencingRequest
        EntityName = referencingEntity

    CanBeReferencingResponse canBeReferencingResponse =

    if (!canBeReferencingResponse.CanBeReferencing)
            "Entity {0} can't be the referencing entity in this one-to-many relationship", 

    if (canBeReferencedResponse.CanBeReferenced == true
        && canBeReferencingResponse.CanBeReferencing == true)
        return true;
        return false;

Message Availability

Untuk mesej ini memberi kesan, pemanggil mestilah disambungkan kepada pelayan.


Pass an instance of this class to the Execute method, which returns an instance of the CanBeReferencingResponse class.

Privileges and Access Rights

To perform this action, the caller must have the required privileges, as listed in CanBeReferencing Privileges.

Notes for Callers


Sebarang ahli statik awam (Shared dalam Visual Basic) jenis ini adalah selamat rentetan. Dalam apa jua keadaan, ahli tidak dijamin selamat rentetan.

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

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