IRelatedEnd インターフェイス

定義

リレーションシップの End を定義します。

public interface class IRelatedEnd
public interface IRelatedEnd
type IRelatedEnd = interface
Public Interface IRelatedEnd
派生

次の例では、エンティティに新しい SalesOrderHeader エンティティを Contact 追加します。 次に、エンティティからすべての関連する終了を 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は クラスと EntityReference<TEntity> クラスのEntityCollection<TEntity>基底クラスです。

プロパティ

IsLoaded

すべての関連オブジェクトが読み込まれているかどうかを示す値を取得します。

RelationshipName

この関連 End が参加するリレーションシップの名前を取得します。

RelationshipSet

関連 End のメタデータへの参照を返します。

SourceRoleName

リレーションシップのソース End のロール名を取得します。

TargetRoleName

リレーションシップのターゲット端のロール名を取得します。

メソッド

Add(IEntityWithRelationships)

関連 End にオブジェクトを追加します。

Add(Object)

関連 End にオブジェクトを追加します。

Attach(IEntityWithRelationships)

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

Attach(Object)

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

CreateSourceQuery()

関連 End に属するオブジェクトを表す IEnumerable を返します。

GetEnumerator()

関連オブジェクトのコレクションを反復処理する IEnumerator を返します。

Load()

既定のマージ オプションを使用してこの関連 End に関連オブジェクトを読み込みます。

Load(MergeOption)

指定されたマージ オプションを使用して関連 End に関連オブジェクトを読み込みます。

Remove(IEntityWithRelationships)

リレーション端のオブジェクトのコレクションからオブジェクトを削除します。

Remove(Object)

リレーション端のオブジェクトのコレクションからオブジェクトを削除します。

適用対象