Share via


OrganizationServiceContext.Detach Method

Definition

Overloads

Detach(Entity)

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

Detach(Entity, Boolean)

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

Detach(Entity)

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

public:
 bool Detach(Microsoft::Xrm::Sdk::Entity ^ entity);
public bool Detach (Microsoft.Xrm.Sdk.Entity entity);
member this.Detach : Microsoft.Xrm.Sdk.Entity -> bool
Public Function Detach (entity As Entity) As Boolean

Parameters

entity
Entity

The entity to be removed from the set of entities that the OrganizationServiceContext is tracking.

Returns

true if the specified entity was detached; otherwise false.

Remarks

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.

Applies to

Detach(Entity, Boolean)

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

public:
 bool Detach(Microsoft::Xrm::Sdk::Entity ^ entity, bool recursive);
public bool Detach (Microsoft.Xrm.Sdk.Entity entity, bool recursive);
member this.Detach : Microsoft.Xrm.Sdk.Entity * bool -> bool
Public Function Detach (entity As Entity, recursive As Boolean) As Boolean

Parameters

entity
Entity

The entity to be removed from the set of entities that the OrganizationServiceContext is tracking.

recursive
Boolean

true to specify entities to be detached recursively, otherwise false.

Returns

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

Remarks

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.

Applies to