DataServiceContext.AttachLink(Object, String, Object) 方法

定义

通知 DataServiceContext 开始跟踪指定链接,该链接定义了实体对象之间的关系。Notifies the DataServiceContext to start tracking the specified link that defines a relationship between entity objects.

public:
 void AttachLink(System::Object ^ source, System::String ^ sourceProperty, System::Object ^ target);
public void AttachLink (object source, string sourceProperty, object target);
member this.AttachLink : obj * string * obj -> unit
Public Sub AttachLink (source As Object, sourceProperty As String, target As Object)

参数

source
Object

新链接中的源对象。The source object in the new link.

sourceProperty
String

源对象上的属性名称,表示源对象和目标对象之间的链接。The name of the property on the source object that represents the link between the source and target object.

target
Object

链接中的目标对象,已绑定到此调用中指定的源对象。The target object in the link that is bound to the source object specified in this call. 目标对象类型必须是源属性所标识的类型或子类型。The target object must be of the type identified by the source property or a subtype.

例外

sourcesourcePropertytarget 为 null 时。When source, sourceProperty, or target is null.

当两个实体之间已存在链接时。When the link between the two entities already exists.

- 或 --or- sourcetarget 处于 AddedDeleted 状态时。When source or target is in an Added or Deleted state.

适用于