DataServiceContext.AttachLink 方法

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

命名空间:  System.Data.Services.Client
程序集:  Microsoft.Data.Services.Client(在 Microsoft.Data.Services.Client.dll 中)

语法

声明
Public Sub AttachLink ( _
    source As Object, _
    sourceProperty As String, _
    target As Object _
)
用法
Dim instance As DataServiceContext
Dim source As Object
Dim sourceProperty As String
Dim target As Object

instance.AttachLink(source, sourceProperty, _
    target)
public void AttachLink(
    Object source,
    string sourceProperty,
    Object target
)
public:
void AttachLink(
    Object^ source, 
    String^ sourceProperty, 
    Object^ target
)
member AttachLink : 
        source:Object * 
        sourceProperty:string * 
        target:Object -> unit 
public function AttachLink(
    source : Object, 
    sourceProperty : String, 
    target : Object
)

参数

  • sourceProperty
    类型:System.String
    源对象上的属性名称,表示源对象和目标对象之间的链接。
  • target
    类型:System.Object
    链接中的目标对象,已绑定到此调用中指定的源对象。目标对象类型必须是源属性所标识的类型或子类型。

异常

异常 条件
ArgumentNullException

当 source、sourceProperty 或 target 为 null 时。

InvalidOperationException

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

- 或 -

当 source 或 target 处于 AddedDeleted 状态时。

请参阅

参考

DataServiceContext 类

System.Data.Services.Client 命名空间