OrganizationServiceContext.Detach Method (Entity, Boolean)


Applies To: Dynamics CRM 2015

Removes the entity from the set of entities that the OrganizationServiceContext is tracking.

Namespace:   Microsoft.Xrm.Sdk.Client
Assembly:  Microsoft.Xrm.Sdk (in Microsoft.Xrm.Sdk.dll)


public bool Detach(
    Entity entity,
    bool recursive
bool Detach(
    Entity^ entity,
    bool recursive
member Detach : 
        entity:Entity *
        recursive:bool -> bool
Public Function Detach (
    entity As Entity,
    recursive As Boolean
) As Boolean


  • recursive
    Type: System.Boolean

    Type: Boolean. true to specify entities to be detached recursively, otherwise false.

Return Value

Type: System.Boolean

Type: Boolean.
Returns true if the specified entity was detached; otherwise false.


Once an object is detached, it is no longer tracked by the OrganizationServiceContext. The Detach method can be called to detach any object, regardless of its state in the context. After detaching the specified entity, this method also detaches any links related to the entity.

See Also

Detach Overload
OrganizationServiceContext Class
Microsoft.Xrm.Sdk.Client Namespace

Return to top

© 2016 Microsoft. All rights reserved. Copyright