Share via


ReferenceOwnershipBuilder.HasMany Method

Definition

Overloads

HasMany(String, String)

Configures a relationship where this entity type has a collection that contains instances of the other type in the relationship.

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithOne(String) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

HasMany(Type, String)

Configures a relationship where this entity type has a collection that contains instances of the other type in the relationship.

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithOne(String) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

HasMany(String, String)

Source:
ReferenceOwnershipBuilder.cs
Source:
ReferenceOwnershipBuilder.cs

Configures a relationship where this entity type has a collection that contains instances of the other type in the relationship.

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithOne(String) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder HasMany (string relatedTypeName, string navigationName = default);
abstract member HasMany : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder
override this.HasMany : string * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder
Public Overridable Function HasMany (relatedTypeName As String, Optional navigationName As String = Nothing) As CollectionNavigationBuilder

Parameters

relatedTypeName
String

The name of the entity type that this relationship targets.

navigationName
String

The name of the collection navigation property on this entity type that represents the relationship. If no property is specified, the relationship will be configured without a navigation property on this end.

Returns

An object that can be used to configure the relationship.

Applies to

HasMany(Type, String)

Source:
ReferenceOwnershipBuilder.cs
Source:
ReferenceOwnershipBuilder.cs

Configures a relationship where this entity type has a collection that contains instances of the other type in the relationship.

Note that calling this method with no parameters will explicitly configure this side of the relationship to use no navigation property, even if such a property exists on the entity type. If the navigation property is to be used, then it must be specified.

After calling this method, you should chain a call to WithOne(String) to fully configure the relationship. Calling just this method without the chained call will not produce a valid relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder HasMany (Type relatedType, string navigationName = default);
abstract member HasMany : Type * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder
override this.HasMany : Type * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionNavigationBuilder
Public Overridable Function HasMany (relatedType As Type, Optional navigationName As String = Nothing) As CollectionNavigationBuilder

Parameters

relatedType
Type

The entity type that this relationship targets.

navigationName
String

The name of the collection navigation property on this entity type that represents the relationship. If no property is specified, the relationship will be configured without a navigation property on this end.

Returns

An object that can be used to configure the relationship.

Applies to