Class RelationalForeignKeyBuilderExtensions
- Namespace
- Microsoft.EntityFrameworkCore
- Assembly
- Microsoft.EntityFrameworkCore.Relational.dll
Relational database specific extension methods for relationship builders.
public static class RelationalForeignKeyBuilderExtensions
- Inheritance
-
RelationalForeignKeyBuilderExtensions
- Inherited Members
Remarks
See Modeling entity types and relationships for more information and examples.
Methods
CanSetConstraintName(IConventionForeignKeyBuilder, string?, bool)
Returns a value indicating whether the foreign key constraint name can be set for this relationship from the current configuration source
public static bool CanSetConstraintName(this IConventionForeignKeyBuilder relationship, string? name, bool fromDataAnnotation = false)
Parameters
relationshipIConventionForeignKeyBuilderThe builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName(IConventionForeignKeyBuilder, string?, bool)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static IConventionForeignKeyBuilder? HasConstraintName(this IConventionForeignKeyBuilder relationship, string? name, bool fromDataAnnotation = false)
Parameters
relationshipIConventionForeignKeyBuilderThe builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
fromDataAnnotationboolIndicates whether the configuration was specified using a data annotation.
Returns
- IConventionForeignKeyBuilder
The same builder instance if the configuration was applied, null otherwise.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName(OwnershipBuilder, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static OwnershipBuilder HasConstraintName(this OwnershipBuilder ownershipBuilder, string? name)
Parameters
ownershipBuilderOwnershipBuilderThe builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- OwnershipBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName(ReferenceCollectionBuilder, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static ReferenceCollectionBuilder HasConstraintName(this ReferenceCollectionBuilder referenceCollectionBuilder, string? name)
Parameters
referenceCollectionBuilderReferenceCollectionBuilderThe builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- ReferenceCollectionBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName(ReferenceReferenceBuilder, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static ReferenceReferenceBuilder HasConstraintName(this ReferenceReferenceBuilder referenceReferenceBuilder, string? name)
Parameters
referenceReferenceBuilderReferenceReferenceBuilderThe builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- ReferenceReferenceBuilder
The same builder instance so that multiple calls can be chained.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName<TEntity, TDependentEntity>(OwnershipBuilder<TEntity, TDependentEntity>, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static OwnershipBuilder<TEntity, TDependentEntity> HasConstraintName<TEntity, TDependentEntity>(this OwnershipBuilder<TEntity, TDependentEntity> ownershipBuilder, string? name) where TEntity : class where TDependentEntity : class
Parameters
ownershipBuilderOwnershipBuilder<TEntity, TDependentEntity>The builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- OwnershipBuilder<TEntity, TDependentEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntityThe entity type on one end of the relationship.
TDependentEntityThe entity type on the other end of the relationship.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName<TEntity, TRelatedEntity>(ReferenceCollectionBuilder<TEntity, TRelatedEntity>, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static ReferenceCollectionBuilder<TEntity, TRelatedEntity> HasConstraintName<TEntity, TRelatedEntity>(this ReferenceCollectionBuilder<TEntity, TRelatedEntity> referenceCollectionBuilder, string? name) where TEntity : class where TRelatedEntity : class
Parameters
referenceCollectionBuilderReferenceCollectionBuilder<TEntity, TRelatedEntity>The builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- ReferenceCollectionBuilder<TEntity, TRelatedEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntityThe principal entity type in this relationship.
TRelatedEntityThe dependent entity type in this relationship.
Remarks
See Modeling entity types and relationships for more information and examples.
HasConstraintName<TEntity, TRelatedEntity>(ReferenceReferenceBuilder<TEntity, TRelatedEntity>, string?)
Configures the foreign key constraint name for this relationship when targeting a relational database.
public static ReferenceReferenceBuilder<TEntity, TRelatedEntity> HasConstraintName<TEntity, TRelatedEntity>(this ReferenceReferenceBuilder<TEntity, TRelatedEntity> referenceReferenceBuilder, string? name) where TEntity : class where TRelatedEntity : class
Parameters
referenceReferenceBuilderReferenceReferenceBuilder<TEntity, TRelatedEntity>The builder being used to configure the relationship.
namestringThe name of the foreign key constraint.
Returns
- ReferenceReferenceBuilder<TEntity, TRelatedEntity>
The same builder instance so that multiple calls can be chained.
Type Parameters
TEntityThe entity type on one end of the relationship.
TRelatedEntityThe entity type on the other end of the relationship.
Remarks
See Modeling entity types and relationships for more information and examples.