Share via


CollectionNavigationBuilder<TEntity,TRelatedEntity>.WithMany Method

Definition

Overloads

WithMany(Expression<Func<TRelatedEntity,IEnumerable<TEntity>>>)

Configures this as a many-to-many relationship.

WithMany(String)

Configures this as a many-to-many relationship.

WithMany(Expression<Func<TRelatedEntity,IEnumerable<TEntity>>>)

Configures this as a many-to-many relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<TRelatedEntity,TEntity> WithMany (System.Linq.Expressions.Expression<Func<TRelatedEntity,System.Collections.Generic.IEnumerable<TEntity>>> navigationExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<TRelatedEntity,TEntity> WithMany (System.Linq.Expressions.Expression<Func<TRelatedEntity,System.Collections.Generic.IEnumerable<TEntity>?>> navigationExpression);
override this.WithMany : System.Linq.Expressions.Expression<Func<'RelatedEntity, seq<'Entity>>> -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<'RelatedEntity, 'Entity (requires 'RelatedEntity : null and 'Entity : null)>
Public Overridable Function WithMany (navigationExpression As Expression(Of Func(Of TRelatedEntity, IEnumerable(Of TEntity)))) As CollectionCollectionBuilder(Of TRelatedEntity, TEntity)

Parameters

navigationExpression
Expression<Func<TRelatedEntity,IEnumerable<TEntity>>>

A lambda expression representing the collection navigation property on the other end of this relationship (blog => blog.Posts).

Returns

CollectionCollectionBuilder<TRelatedEntity,TEntity>

An object to further configure the relationship.

Applies to

WithMany(String)

Configures this as a many-to-many relationship.

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<TRelatedEntity,TEntity> WithMany (string navigationName);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<TRelatedEntity,TEntity> WithMany (string? navigationName = default);
override this.WithMany : string -> Microsoft.EntityFrameworkCore.Metadata.Builders.CollectionCollectionBuilder<'RelatedEntity, 'Entity (requires 'RelatedEntity : null and 'Entity : null)>
Public Overridable Function WithMany (navigationName As String) As CollectionCollectionBuilder(Of TRelatedEntity, TEntity)
Public Overridable Function WithMany (Optional navigationName As String = Nothing) As CollectionCollectionBuilder(Of TRelatedEntity, TEntity)

Parameters

navigationName
String

The name of the collection navigation property on the other end of this relationship. Can be null to create a unidirectional relationship.

Returns

CollectionCollectionBuilder<TRelatedEntity,TEntity>

An object to further configure the relationship.

Applies to