EntityTypeConfiguration<TEntityType>.HasMany<TTargetEntity> 方法

定义

通过此实体类型配置一对多关系。

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public System.Data.Entity.ModelConfiguration.Configuration.ManyNavigationPropertyConfiguration<TEntityType,TTargetEntity> HasMany<TTargetEntity> (System.Linq.Expressions.Expression<Func<TEntityType,System.Collections.Generic.ICollection<TTargetEntity>>> navigationPropertyExpression) where TTargetEntity : class;
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public System.Data.Entity.ModelConfiguration.Configuration.ManyNavigationPropertyConfiguration<TEntityType,TTargetEntity> HasMany<TTargetEntity> (System.Linq.Expressions.Expression<Func<TEntityType,System.Collections.Generic.ICollection<TTargetEntity>>> navigationPropertyExpression) where TTargetEntity : class;
member this.HasMany : System.Linq.Expressions.Expression<Func<'EntityType, System.Collections.Generic.ICollection<'argetEntity>>> -> System.Data.Entity.ModelConfiguration.Configuration.ManyNavigationPropertyConfiguration<'EntityType, 'argetEntity (requires 'EntityType : null and 'argetEntity : null)> (requires 'argetEntity : null)
Public Function HasMany(Of TTargetEntity As Class) (navigationPropertyExpression As Expression(Of Func(Of TEntityType, ICollection(Of TTargetEntity)))) As ManyNavigationPropertyConfiguration(Of TEntityType, TTargetEntity)

类型参数

TTargetEntity

位于关系另一端的实体的类型。

参数

navigationPropertyExpression
Expression<Func<TEntityType,ICollection<TTargetEntity>>>

一个 lambda 表达式,表示关系的导航属性。 C#: t => t.MyProperty VB.Net: Function (t) t.MyProperty

返回

ManyNavigationPropertyConfiguration<TEntityType,TTargetEntity>

一个配置对象,可用于进一步配置关系。

属性

适用于