DbEntityEntry<TEntity>.Collection<TElement> 方法 (Expression<Func<TEntity, ICollection<TElement>>>)
[本页针对的是实体框架版本 6。最新版本以“实体框架”NuGet 包的形式提供。有关实体框架的更多信息,请参见 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
集合中的元素类型。
参数
- navigationProperty
类型:System.Linq.Expressions.Expression<Func<TEntity, ICollection<TElement>>>
表示导航属性的表达式。
返回值
类型:System.Data.Entity.Infrastructure.DbCollectionEntry<TEntity, TElement>
表示导航属性的对象。