共用方式為


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>

要進一步設定關聯性的 物件。

適用於