Share via


EntityTypeConfiguration<TEntityType>.HasMany<TTargetEntity> Method

[This page is specific to the Entity Framework version 6. The latest version is available as the 'Entity Framework' NuGet package. For more information about Entity Framework, see msdn.com/data/ef.]

Configures a many relationship from this entity type.

Namespace:  System.Data.Entity.ModelConfiguration
Assembly:  EntityFramework (in EntityFramework.dll)

Syntax

'Declaration
<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")> _
<SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")> _
Public Function HasMany(Of TTargetEntity As Class) ( _
    navigationPropertyExpression As Expression(Of Func(Of TEntityType, ICollection(Of TTargetEntity))) _
) As ManyNavigationPropertyConfiguration(Of TEntityType, TTargetEntity)
'Usage
Dim instance As EntityTypeConfiguration 
Dim navigationPropertyExpression As Expression(Of Func(Of TEntityType, ICollection(Of TTargetEntity)))
Dim returnValue As ManyNavigationPropertyConfiguration(Of TEntityType, TTargetEntity)

returnValue = instance.HasMany(navigationPropertyExpression)
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public ManyNavigationPropertyConfiguration<TEntityType, TTargetEntity> HasMany<TTargetEntity>(
    Expression<Func<TEntityType, ICollection<TTargetEntity>>> navigationPropertyExpression
)
where TTargetEntity : class
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute(L"Microsoft.Design", L"CA1011:ConsiderPassingBaseTypesAsParameters")]
public:
generic<typename TTargetEntity>
where TTargetEntity : ref class 
ManyNavigationPropertyConfiguration<TEntityType, TTargetEntity>^ HasMany(
    Expression<Func<TEntityType, ICollection<TTargetEntity>^>^>^ navigationPropertyExpression
)
[<SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")>]
[<SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")>]
member HasMany : 
        navigationPropertyExpression:Expression<Func<'TEntityType, ICollection<'TTargetEntity>>> -> ManyNavigationPropertyConfiguration<'TEntityType, 'TTargetEntity>  when 'TTargetEntity : not struct
JScript does not support generic types and methods.

Type Parameters

  • TTargetEntity
    The type of the entity at the other end of the relationship.

Parameters

Return Value

Type: System.Data.Entity.ModelConfiguration.Configuration.ManyNavigationPropertyConfiguration<TEntityType, TTargetEntity>
A configuration object that can be used to further configure the relationship.

See Also

Reference

EntityTypeConfiguration<TEntityType> Class

System.Data.Entity.ModelConfiguration Namespace