RelationalForeignKeyBuilderExtensions.HasConstraintName Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
HasConstraintName(OwnershipBuilder, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName(ReferenceCollectionBuilder, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName(ReferenceReferenceBuilder, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName(IConventionForeignKeyBuilder, String, Boolean) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName(IConventionRelationshipBuilder, String, Boolean) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String) |
Configures the foreign key constraint name for this relationship when targeting a relational database. |
HasConstraintName(OwnershipBuilder, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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
Parameters
- ownershipBuilder
- OwnershipBuilder
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName(ReferenceCollectionBuilder, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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
Parameters
- referenceCollectionBuilder
- ReferenceCollectionBuilder
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName(ReferenceReferenceBuilder, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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
Parameters
- referenceReferenceBuilder
- ReferenceReferenceBuilder
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName(IConventionForeignKeyBuilder, String, Boolean)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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
Parameters
- relationship
- IConventionForeignKeyBuilder
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied,
null
otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName(IConventionRelationshipBuilder, String, Boolean)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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
Parameters
- relationship
- IConventionRelationshipBuilder
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
- fromDataAnnotation
- Boolean
Indicates whether the configuration was specified using a data annotation.
Returns
The same builder instance if the configuration was applied,
null
otherwise.
Applies to
HasConstraintName<TEntity,TDependentEntity>(OwnershipBuilder<TEntity,TDependentEntity>, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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)
Type Parameters
- TEntity
The entity type on one end of the relationship.
- TDependentEntity
The entity type on the other end of the relationship.
Parameters
- ownershipBuilder
- OwnershipBuilder<TEntity,TDependentEntity>
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName<TEntity,TRelatedEntity>(ReferenceCollectionBuilder<TEntity,TRelatedEntity>, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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)
Type Parameters
- TEntity
The principal entity type in this relationship.
- TRelatedEntity
The dependent entity type in this relationship.
Parameters
- referenceCollectionBuilder
- ReferenceCollectionBuilder<TEntity,TRelatedEntity>
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
HasConstraintName<TEntity,TRelatedEntity>(ReferenceReferenceBuilder<TEntity,TRelatedEntity>, String)
Configures the foreign key constraint name for this relationship when targeting a relational database.
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)
Type Parameters
- TEntity
The entity type on one end of the relationship.
- TRelatedEntity
The entity type on the other end of the relationship.
Parameters
- referenceReferenceBuilder
- ReferenceReferenceBuilder<TEntity,TRelatedEntity>
The builder being used to configure the relationship.
- name
- String
The name of the foreign key constraint.
Returns
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
Applies to
Entity Framework