语言

ReferenceCollectionBuilder<TPrincipalEntity,TDependentEntity>.IsConstrained 方法

定义

配置关系是否受约束。 创建数据库外键约束时 false,查询将关系视为可选(主体不假定存在),即使外键属性不可为 null 也是如此。 这不会影响更改跟踪。 请参阅 IsConstrained。

public virtual Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TPrincipalEntity,TDependentEntity> IsConstrained(bool constrained = true);
override this.IsConstrained : bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'PrincipalEntity, 'DependentEntity (requires 'PrincipalEntity : null and 'DependentEntity : null)>
Public Overridable Function IsConstrained (Optional constrained As Boolean = true) As ReferenceCollectionBuilder(Of TPrincipalEntity, TDependentEntity)

参数

constrained
Boolean

一个值,该值指示关系是否受到约束。

返回

同一个生成器实例,以便可以链接多个配置调用。

适用于