Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

DataServiceContext.AddLink Method

Adds the specified link to the set of objects the DataServiceContext is tracking.

Namespace:  System.Data.Services.Client
Assembly:  Microsoft.Data.Services.Client (in Microsoft.Data.Services.Client.dll)
public void AddLink(
	Object source,
	string sourceProperty,
	Object target
)

Parameters

source
Type: System.Object
The source object for the new link.
sourceProperty
Type: System.String
The name of the navigation property on the source object that returns the related object.
target
Type: System.Object
The object related to the source object by the new link.
ExceptionCondition
ArgumentNullException

When source, sourceProperty, or target are null.

InvalidOperationException

If a link already exists.

-or-

If either the source or target objects are in a Detached or Deleted state.

-or-

If sourceProperty is not a collection.

Notifies the DataServiceContext that a new link exists between the related source and target objects and that the link is represented by the specified source property. The DataServiceContext adds this link to the set of newly created links that will be sent to the data service on the next call to SaveChanges. For more information, see Updating the Data Service (WCF Data Services).

The target object must be of the type identified by the sourceProperty parameter or a subtype of the type.

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.