CollectionNavigationBuilder<TEntity,TRelatedEntity>.WithMany 方法

定义

重载

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

将此配置为多对多关系。

WithMany(String)

将此配置为多对多关系。

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

将此配置为多对多关系。

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)

参数

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

表示此关系另一端的集合导航属性的 lambda 表达式 (blog => blog.Posts) 。

返回

CollectionCollectionBuilder<TRelatedEntity,TEntity>

用于进一步配置关系的 对象。

适用于

WithMany(String)

将此配置为多对多关系。

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)

参数

navigationName
String

此关系另一端的集合导航属性的名称。 可以 null 创建单向关系。

返回

CollectionCollectionBuilder<TRelatedEntity,TEntity>

用于进一步配置关系的 对象。

适用于