Share via


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

定义

通知 DataServiceContext 开始跟踪指定链接,该链接定义了实体对象之间的关系。

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

新链接中的源对象。

sourceProperty
String

源对象上的属性名称,表示源对象和目标对象之间的链接。

target
Object

链接中的目标对象,已绑定到此调用中指定的源对象。 目标对象类型必须是源属性所标识的类型或子类型。

例外

sourcesourcePropertytarget 为 null。

两个实体之间的链接已存在。

-或-

sourcetarget 处于 AddedDeleted 状态。

适用于