RelatedEnd.Attach<TEntity>(IEnumerable<TEntity>, Boolean) メソッド

定義

2 つのアタッチされたオブジェクト間のリレーションシップを定義します。

protected public:
generic <typename TEntity>
 void Attach(System::Collections::Generic::IEnumerable<TEntity> ^ entities, bool allowCollection);
protected internal void Attach<TEntity>(System.Collections.Generic.IEnumerable<TEntity> entities, bool allowCollection);
member this.Attach : seq<'Entity> * bool -> unit
Protected Friend Sub Attach(Of TEntity) (entities As IEnumerable(Of TEntity), allowCollection As Boolean)

型パラメーター

TEntity

アタッチするエンティティ オブジェクトの IEnumerable<T> コレクションの型。

パラメーター

entities
IEnumerable<TEntity>

エンティティ オブジェクトの IEnumerable<T> コレクション。

allowCollection
Boolean

アタッチするオブジェクトがコレクションの一部かどうかを指定します。

注釈

Attach<TEntity>(IEnumerable<TEntity>, Boolean) メソッドは、両方のオブジェクトが既にオブジェクト コンテキストにアタッチされている場合に、オブジェクトと関連オブジェクトの間のリレーションシップを定義するために使用されます。 関連オブジェクトをValueEntityReference<TEntity> プロパティに設定するか、関連オブジェクトがまだオブジェクト コンテキストにアタッチされていない場合は、AddEntityCollection<TEntity> メソッドを呼び出します。 両方のオブジェクトがデタッチされている場合は、関連オブジェクトをValueEntityReference<TEntity> プロパティに設定するか、AddEntityCollection<TEntity> メソッドを呼び出して、オブジェクト グラフにルート オブジェクトをアタッチすることで、リレーションシップを定義することもできます。 詳しくは、「オブジェクトのアタッチとデタッチ」をご覧ください。

Attach<TEntity>(IEnumerable<TEntity>, Boolean) メソッドは、関連するエンドに対するアタッチ操作中に Object Services によって呼び出されます。

適用対象