Share via


DbEntityEntry<TEntity>.Collection<TElement> 方法 (Expression<Func<TEntity, ICollection<TElement>>>)

[此頁面專屬於 Entity Framework 第 6 版。最新版本可從 'Entity Framework' NuGet 套件取得。如需 Entity Framework 的詳細資訊,請參閱 msdn.com/data/ef。]

取得物件,表示從此實體到相關實體集的集合導覽屬性。

命名空間:  System.Data.Entity.Infrastructure
組件:  EntityFramework (在 EntityFramework.dll 中)

語法

'宣告
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
Public Function Collection(Of TElement As Class) ( _
    navigationProperty As Expression(Of Func(Of TEntity, ICollection(Of TElement))) _
) As DbCollectionEntry(Of TEntity, TElement)
'用途
Dim instance As DbEntityEntry 
Dim navigationProperty As Expression(Of Func(Of TEntity, ICollection(Of TElement)))
Dim returnValue As DbCollectionEntry(Of TEntity, TElement)

returnValue = instance.Collection(navigationProperty)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public DbCollectionEntry<TEntity, TElement> Collection<TElement>(
    Expression<Func<TEntity, ICollection<TElement>>> navigationProperty
)
where TElement : class
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
public:
generic<typename TElement>
where TElement : ref class 
DbCollectionEntry<TEntity, TElement>^ Collection(
    Expression<Func<TEntity, ICollection<TElement>^>^>^ navigationProperty
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
member Collection : 
        navigationProperty:Expression<Func<'TEntity, ICollection<'TElement>>> -> DbCollectionEntry<'TEntity, 'TElement>  when 'TElement : not struct
JScript does not support generic types and methods.

類型參數

  • TElement
    集合中項目的類型。

參數

傳回值

類型:System.Data.Entity.Infrastructure.DbCollectionEntry<TEntity, TElement>
表示導覽屬性的物件。

請參閱

參考

DbEntityEntry<TEntity> 類別

Collection 多載

System.Data.Entity.Infrastructure 命名空間