Partager via


DataServiceContext.Detach Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Removes the entity from the list of entities that the DataServiceContext is tracking.

Namespace:  System.Data.Services.Client
Assembly:  System.Data.Services.Client (in System.Data.Services.Client.dll)

Syntax

'Declaration
Public Function Detach ( _
    entity As Object _
) As Boolean
public bool Detach(
    Object entity
)

Parameters

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

When entity is nulla null reference (Nothing in Visual Basic).

Remarks

After an entity is detached, it is unaffected by operations in the DataServiceContext.

Any entity being tracked by the DataServiceContext, whether in the added, modified, deleted, or unchanged state, the entity may be detached.

After detaching the specified entity, this method also detaches any links related to the entity.

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.