指定されたリソースの追跡を開始するように DataServiceContext に通知し、指定されたリソース セット内のそのリソースの場所を提供します。
名前空間: System.Data.Services.Client
アセンブリ: Microsoft.Data.Services.Client (Microsoft.Data.Services.Client.dll)
構文
'宣言
Public Sub AttachTo ( _
entitySetName As String, _
entity As Object _
)
'使用
Dim instance As DataServiceContext
Dim entitySetName As String
Dim entity As Object
instance.AttachTo(entitySetName, entity)
public void AttachTo(
string entitySetName,
Object entity
)
public:
void AttachTo(
String^ entitySetName,
Object^ entity
)
member AttachTo :
entitySetName:string *
entity:Object -> unit
public function AttachTo(
entitySetName : String,
entity : Object
)
パラメーター
- entitySetName
型: System.String
リソースを含むセットの名前。
- entity
型: System.Object
DataServiceContext によって追跡されるリソース。このリソースは、変更なしの状態でアタッチされます。
例外
| 例外 | 条件 |
|---|---|
| ArgumentNullException | entity または entitySetName が nullNULL 参照 (Visual Basic では Nothing) の場合。 |
| ArgumentException | entitySetName が空の文字列である場合。 または entity にキー プロパティが定義されていない場合。 |
| InvalidOperationException | entity がコンテキストによって既に追跡されている場合。 |
説明
エンティティがオブジェクト グラフの一部である場合、この操作ではグラフを走査して関連オブジェクトを追加することはしません。 これは簡易操作です。
このメソッドは、DataServiceContext に関連付けられたデータ サービスで、指定されたエンティティ セットが発生するかどうかを検証しません。