ReferenceNavigationBuilder<TEntity,TRelatedEntity>.WithMany 方法

定义

重载

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

将此配置为一对多关系。

WithMany(String)

将此配置为一对多关系。

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

Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs

将此配置为一对多关系。

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TRelatedEntity,TEntity> WithMany (System.Linq.Expressions.Expression<Func<TRelatedEntity,System.Collections.Generic.IEnumerable<TEntity>>> navigationExpression);
public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<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.ReferenceCollectionBuilder<'RelatedEntity, 'Entity (requires 'RelatedEntity : null and 'Entity : null)>
Public Overridable Function WithMany (navigationExpression As Expression(Of Func(Of TRelatedEntity, IEnumerable(Of TEntity)))) As ReferenceCollectionBuilder(Of TRelatedEntity, TEntity)

参数

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

表示此关系另一端的集合导航属性的 lambda 表达式 (blog => blog.Posts) 。 如果未指定任何属性,则将在关系的另一端配置关系,而不使用导航属性。

返回

ReferenceCollectionBuilder<TRelatedEntity,TEntity>

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

注解

请注意,在没有参数的情况下调用此方法会将关系的此端显式配置为不使用导航属性,即使实体类型上存在此类属性也是如此。 如果要使用导航属性,则必须指定它。

适用于

WithMany(String)

Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs
Source:
ReferenceNavigationBuilder%60.cs

将此配置为一对多关系。

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

参数

navigationName
String

此关系另一端的集合导航属性的名称。 如果为 null 或未指定,则关系的另一端没有导航属性。

返回

ReferenceCollectionBuilder<TRelatedEntity,TEntity>

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

注解

请注意,在没有参数的情况下调用此方法会将关系的此端显式配置为不使用导航属性,即使实体类型上存在此类属性也是如此。 如果要使用导航属性,则必须指定它。

适用于