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
)
參數
- source
型別:System.Object
新連結中的來源物件。
- sourceProperty
型別:System.String
來源物件上的屬性名稱,表示來源與目標物件之間的連結。
- target
型別:System.Object
連結中的目標物件,這個連結繫結至這個呼叫中指定的來源物件。目標物件必須是來源屬性所識別的型別,或是該型別的子型別。
例外狀況
例外狀況 | 條件 |
---|---|
ArgumentNullException | 當 source、sourceProperty 或 target 為 null 時。 |
InvalidOperationException | 當兩個實體之間的連結已存在時。 -或- |