The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

DataServiceContext.Detach Method (Object)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

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)

public bool Detach(
	object entity


Type: System.Object

The tracked entity to be detached from the DataServiceContext.

Return Value

Type: System.Boolean

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

Exception Condition

When entity is null.

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.

.NET Framework
Available since 3.5
Available since 2.0
Return to top