Tuesday, September 23, 2008

Delete / DisAssociate Many to Many Relationship Record.


When you say DisAssocaiating a Many to Many Relationship Record, then you usually deattach the record, you won't delete the record.

Below function will DisAssocaiate a record. Here, you need to pass three parameter values
Parent Entity Guid,
Child Entity Guid, and
Relationship Name.

public bool DisassociateManyToManyEntityRecords(Moniker Moniker1, Moniker Moniker2, string strEntityRelationshipName)
{
try
{
// Create a request.
DisassociateEntitiesRequest request = new DisassociateEntitiesRequest();

        // Assign the request a moniker for both entities that need to be disassociated.
request.Moniker1 = Moniker1;
request.Moniker2 = Moniker2;

        // Set the relationship name that associates the two entities.
request.RelationshipName = strEntityRelationshipName.Trim();
        // Execute the request.
DisassociateEntitiesResponse response = (DisassociateEntitiesResponse)Service.Execute(request);

        return true;
}

    catch (SoapException ex)
{
return false;
}
}

1 comment:

Richard C. Lambert said...

Wow what a Great Information about World Day its exceptionally pleasant educational post. a debt of gratitude is in order for the post.
digital marketing westchester New York