Table of Contents

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

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

relationship IConventionForeignKeyBuilder

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

bool

true if the configuration can be applied.

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

relationship IConventionForeignKeyBuilder

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

fromDataAnnotation bool

Indicates whether the configuration was specified using a data annotation.

Returns

IConventionForeignKeyBuilder

The same builder instance if the configuration was applied, null otherwise.

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

ownershipBuilder OwnershipBuilder

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

OwnershipBuilder

The same builder instance so that multiple calls can be chained.

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

referenceCollectionBuilder ReferenceCollectionBuilder

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

ReferenceCollectionBuilder

The same builder instance so that multiple calls can be chained.

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

referenceReferenceBuilder ReferenceReferenceBuilder

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

ReferenceReferenceBuilder

The same builder instance so that multiple calls can be chained.

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

ownershipBuilder OwnershipBuilder<TEntity, TDependentEntity>

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

OwnershipBuilder<TEntity, TDependentEntity>

The same builder instance so that multiple calls can be chained.

Type Parameters

TEntity

The entity type on one end of the relationship.

TDependentEntity

The entity type on the other end of the relationship.

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

referenceCollectionBuilder ReferenceCollectionBuilder<TEntity, TRelatedEntity>

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

ReferenceCollectionBuilder<TEntity, TRelatedEntity>

The same builder instance so that multiple calls can be chained.

Type Parameters

TEntity

The principal entity type in this relationship.

TRelatedEntity

The dependent entity type in this relationship.

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

referenceReferenceBuilder ReferenceReferenceBuilder<TEntity, TRelatedEntity>

The builder being used to configure the relationship.

name string

The name of the foreign key constraint.

Returns

ReferenceReferenceBuilder<TEntity, TRelatedEntity>

The same builder instance so that multiple calls can be chained.

Type Parameters

TEntity

The entity type on one end of the relationship.

TRelatedEntity

The entity type on the other end of the relationship.