SALES: 1-800-867-1380
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.AttachTo Method (String, Object)

Notifies the DataServiceContext to start tracking the specified resource and supplies the location of the resource within the specified resource set.

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

public void AttachTo(
	string entitySetName,
	Object entity


Type: System.String
The name of the set that contains the resource.
Type: System.Object
The resource to be tracked by the DataServiceContext. The resource is attached in the Unchanged state.


When entity or entitySetName is null.


When entitySetName is an empty string.


When the entity does not have a key property defined.


When the entity is already being tracked by the context.

If the entity is part of an object graph, this operation does not traverse the graph to add related objects. It is a shallow operation.

The method does not validate whether the specified entity set occurs in the data service associated with the DataServiceContext.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft