Share via


DataServiceContext.Detach Method

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

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

Syntax

'Declaration
Public Function Detach ( _
    entity As Object _
) As Boolean
'Usage
Dim instance As DataServiceContext 
Dim entity As Object 
Dim returnValue As Boolean 

returnValue = instance.Detach(entity)
public bool Detach(
    Object entity
)
public:
bool Detach(
    Object^ entity
)
member Detach : 
        entity:Object -> bool
public function Detach(
    entity : Object
) : boolean

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

Once an object is detached, it is no longer tracked by the DataServiceContext.

The Detach method can be called to detach any object, regardless of its EntityStates.

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

See Also

Reference

DataServiceContext Class

System.Data.Services.Client Namespace