IRelatedEnd インターフェイス
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
リレーションシップの終了を定義します。
public interface class IRelatedEnd
public interface IRelatedEnd
type IRelatedEnd = interface
Public Interface IRelatedEnd
- 派生
例
次の例では、Contact エンティティに新しいSalesOrderHeader エンティティを追加します。 次に、 Contact エンティティからすべての関連する末尾を取得し、関連する各エンドのリレーションシップ名、ソース ロール名、およびターゲット ロール名を表示します。
using (AdventureWorksEntities context =
new AdventureWorksEntities())
{
Contact contact = new Contact();
// Create a new SalesOrderHeader.
SalesOrderHeader newSalesOrder1 = new SalesOrderHeader();
// Add SalesOrderHeader to the Contact.
contact.SalesOrderHeaders.Add(newSalesOrder1);
// Create another SalesOrderHeader.
SalesOrderHeader newSalesOrder2 = new SalesOrderHeader();
// Add SalesOrderHeader to the Contact.
contact.SalesOrderHeaders.Add(newSalesOrder2);
// Get all related ends
IEnumerable<IRelatedEnd> relEnds =
((IEntityWithRelationships)contact).RelationshipManager
.GetAllRelatedEnds();
foreach (IRelatedEnd relEnd in relEnds)
{
Console.WriteLine("Relationship Name: {0}", relEnd.RelationshipName);
Console.WriteLine("Source Role Name: {0}", relEnd.SourceRoleName);
Console.WriteLine("Target Role Name: {0}", relEnd.TargetRoleName);
}
}
注釈
IRelatedEnd は、関連付けの末尾を表すオブジェクトの要件を定義します。 このインターフェイスは、 RelatedEnd クラスによって実装されます。 RelatedEnd は、 EntityCollection<TEntity> クラスと EntityReference<TEntity> クラスの基本クラスです。
プロパティ
| 名前 | 説明 |
|---|---|
| IsLoaded |
すべての関連オブジェクトが読み込まれたかどうかを示す値を取得します。 |
| RelationshipName |
この関連エンドが参加するリレーションシップの名前を取得します。 |
| RelationshipSet |
関連する末尾のメタデータへの参照を返します。 |
| SourceRoleName |
リレーションシップのソース末尾にあるロール名を取得します。 |
| TargetRoleName |
リレーションシップのターゲットの末尾にあるロール名を取得します。 |
メソッド
| 名前 | 説明 |
|---|---|
| Add(IEntityWithRelationships) |
関連する末尾にオブジェクトを追加します。 |
| Add(Object) |
関連する末尾にオブジェクトを追加します。 |
| Attach(IEntityWithRelationships) |
2 つのアタッチされたオブジェクト間のリレーションシップを定義します。 |
| Attach(Object) |
2 つのアタッチされたオブジェクト間のリレーションシップを定義します。 |
| CreateSourceQuery() |
関連する末尾に属するオブジェクトを表す IEnumerable を返します。 |
| GetEnumerator() |
関連オブジェクトのコレクションを反復処理する IEnumerator を返します。 |
| Load() |
既定のマージ オプションを使用して、関連オブジェクトをこの関連する末尾に読み込みます。 |
| Load(MergeOption) |
指定したマージ オプションを使用して、関連するオブジェクトを関連する末尾に読み込みます。 |
| Remove(IEntityWithRelationships) |
関連する末尾にあるオブジェクトのコレクションからオブジェクトを削除します。 |
| Remove(Object) |
関連する末尾にあるオブジェクトのコレクションからオブジェクトを削除します。 |