RelationalForeignKeyBuilderExtensions.HasConstraintName 方法

定义

重载

HasConstraintName(OwnershipBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName(ReferenceCollectionBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName(ReferenceReferenceBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName(IConventionForeignKeyBuilder, String, Boolean)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName(IConventionRelationshipBuilder, String, Boolean)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

HasConstraintName(OwnershipBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder ownershipBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder ownershipBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder
<Extension()>
Public Function HasConstraintName (ownershipBuilder As OwnershipBuilder, name As String) As OwnershipBuilder

参数

ownershipBuilder
OwnershipBuilder

用于配置关系的生成器。

name
String

外键约束的名称。

返回

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName(ReferenceCollectionBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder referenceCollectionBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder referenceCollectionBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder
<Extension()>
Public Function HasConstraintName (referenceCollectionBuilder As ReferenceCollectionBuilder, name As String) As ReferenceCollectionBuilder

参数

referenceCollectionBuilder
ReferenceCollectionBuilder

用于配置关系的生成器。

name
String

外键约束的名称。

返回

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName(ReferenceReferenceBuilder, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder referenceReferenceBuilder, string name);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder referenceReferenceBuilder, string? name);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder
<Extension()>
Public Function HasConstraintName (referenceReferenceBuilder As ReferenceReferenceBuilder, name As String) As ReferenceReferenceBuilder

参数

referenceReferenceBuilder
ReferenceReferenceBuilder

用于配置关系的生成器。

name
String

外键约束的名称。

返回

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName(IConventionForeignKeyBuilder, String, Boolean)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder relationship, string name, bool fromDataAnnotation = false);
public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder? HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder relationship, string? name, bool fromDataAnnotation = false);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionForeignKeyBuilder
<Extension()>
Public Function HasConstraintName (relationship As IConventionForeignKeyBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionForeignKeyBuilder

参数

relationship
IConventionForeignKeyBuilder

用于配置关系的生成器。

name
String

外键约束的名称。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

如果应用了配置,则为同一生成器实例, null 否则为 。

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName(IConventionRelationshipBuilder, String, Boolean)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder HasConstraintName (this Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder relationship, string name, bool fromDataAnnotation = false);
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder * string * bool -> Microsoft.EntityFrameworkCore.Metadata.Builders.IConventionRelationshipBuilder
<Extension()>
Public Function HasConstraintName (relationship As IConventionRelationshipBuilder, name As String, Optional fromDataAnnotation As Boolean = false) As IConventionRelationshipBuilder

参数

relationship
IConventionRelationshipBuilder

用于配置关系的生成器。

name
String

外键约束的名称。

fromDataAnnotation
Boolean

指示配置是否是使用数据注释指定的。

返回

如果应用了配置,则为同一生成器实例, null 否则为 。

适用于

HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasConstraintName<TEntity,TDependentEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> ownershipBuilder, string name) where TEntity : class where TDependentEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> HasConstraintName<TEntity,TDependentEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<TEntity,TDependentEntity> ownershipBuilder, string? name) where TEntity : class where TDependentEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.OwnershipBuilder<'Entity, 'DependentEntity (requires 'Entity : null and 'DependentEntity : null)> (requires 'Entity : null and 'DependentEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TDependentEntity As Class) (ownershipBuilder As OwnershipBuilder(Of TEntity, TDependentEntity), name As String) As OwnershipBuilder(Of TEntity, TDependentEntity)

类型参数

TEntity

关系一端的实体类型。

TDependentEntity

关系另一端的实体类型。

参数

ownershipBuilder
OwnershipBuilder<TEntity,TDependentEntity>

用于配置关系的生成器。

name
String

外键约束的名称。

返回

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> referenceCollectionBuilder, string name) where TEntity : class where TRelatedEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<TEntity,TRelatedEntity> referenceCollectionBuilder, string? name) where TEntity : class where TRelatedEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceCollectionBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'Entity : null and 'RelatedEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TRelatedEntity As Class) (referenceCollectionBuilder As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity), name As String) As ReferenceCollectionBuilder(Of TEntity, TRelatedEntity)

类型参数

TEntity

此关系中的主体实体类型。

TRelatedEntity

此关系中的依赖实体类型。

参数

referenceCollectionBuilder
ReferenceCollectionBuilder<TEntity,TRelatedEntity>

用于配置关系的生成器。

name
String

外键约束的名称。

返回

ReferenceCollectionBuilder<TEntity,TRelatedEntity>

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于

HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String)

在面向关系数据库时为此关系配置外键约束名称。

public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> referenceReferenceBuilder, string name) where TEntity : class where TRelatedEntity : class;
public static Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> HasConstraintName<TEntity,TRelatedEntity> (this Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<TEntity,TRelatedEntity> referenceReferenceBuilder, string? name) where TEntity : class where TRelatedEntity : class;
static member HasConstraintName : Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> * string -> Microsoft.EntityFrameworkCore.Metadata.Builders.ReferenceReferenceBuilder<'Entity, 'RelatedEntity (requires 'Entity : null and 'RelatedEntity : null)> (requires 'Entity : null and 'RelatedEntity : null)
<Extension()>
Public Function HasConstraintName(Of TEntity As Class, TRelatedEntity As Class) (referenceReferenceBuilder As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity), name As String) As ReferenceReferenceBuilder(Of TEntity, TRelatedEntity)

类型参数

TEntity

关系一端的实体类型。

TRelatedEntity

关系另一端的实体类型。

参数

referenceReferenceBuilder
ReferenceReferenceBuilder<TEntity,TRelatedEntity>

用于配置关系的生成器。

name
String

外键约束的名称。

返回

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

注解

有关详细信息和示例,请参阅 为实体类型和关系建模

适用于