Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ForeignKeyIndexConvention Class

Definition

Namespace:
Microsoft.EntityFrameworkCore.Metadata.Conventions
Assembly:
Microsoft.EntityFrameworkCore.dll
Package:
Microsoft.EntityFrameworkCore v10.0.0
Package:
Microsoft.EntityFrameworkCore v3.0.0
Package:
Microsoft.EntityFrameworkCore v3.1.0
Package:
Microsoft.EntityFrameworkCore v5.0.0
Package:
Microsoft.EntityFrameworkCore v6.0.0
Package:
Microsoft.EntityFrameworkCore v7.0.0
Package:
Microsoft.EntityFrameworkCore v8.0.0
Package:
Microsoft.EntityFrameworkCore v9.0.0
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs
Source:
ForeignKeyIndexConvention.cs

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.

A convention that creates indexes on foreign key properties unless they are already covered by existing indexes or keys.

[System.Runtime.CompilerServices.Nullable(0)]
public class ForeignKeyIndexConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention
public class ForeignKeyIndexConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizedConvention
public class ForeignKeyIndexConvention : Microsoft.EntityFrameworkCore.Metadata.Conventions.IEntityTypeBaseTypeChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyPropertiesChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IForeignKeyUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IIndexUniquenessChangedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyAddedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IKeyRemovedConvention, Microsoft.EntityFrameworkCore.Metadata.Conventions.IModelFinalizingConvention
[<System.Runtime.CompilerServices.Nullable(0)>]
type ForeignKeyIndexConvention = class
 interface IForeignKeyAddedConvention
 interface IConvention
 interface IForeignKeyRemovedConvention
 interface IForeignKeyPropertiesChangedConvention
 interface IForeignKeyUniquenessChangedConvention
 interface IKeyAddedConvention
 interface IKeyRemovedConvention
 interface IEntityTypeBaseTypeChangedConvention
 interface IIndexAddedConvention
 interface IIndexRemovedConvention
 interface IIndexUniquenessChangedConvention
 interface IModelFinalizingConvention
type ForeignKeyIndexConvention = class
 interface IForeignKeyAddedConvention
 interface IConvention
 interface IForeignKeyRemovedConvention
 interface IForeignKeyPropertiesChangedConvention
 interface IForeignKeyUniquenessChangedConvention
 interface IKeyAddedConvention
 interface IKeyRemovedConvention
 interface IEntityTypeBaseTypeChangedConvention
 interface IIndexAddedConvention
 interface IIndexRemovedConvention
 interface IIndexUniquenessChangedConvention
 interface IModelFinalizedConvention
type ForeignKeyIndexConvention = class
 interface IForeignKeyAddedConvention
 interface IConvention
 interface IForeignKeyRemovedConvention
 interface IForeignKeyPropertiesChangedConvention
 interface IForeignKeyUniquenessChangedConvention
 interface IKeyAddedConvention
 interface IKeyRemovedConvention
 interface IEntityTypeBaseTypeChangedConvention
 interface IIndexAddedConvention
 interface IIndexRemovedConvention
 interface IIndexUniquenessChangedConvention
 interface IModelFinalizingConvention
Public Class ForeignKeyIndexConvention
Implements IEntityTypeBaseTypeChangedConvention, IForeignKeyAddedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRemovedConvention, IForeignKeyUniquenessChangedConvention, IIndexAddedConvention, IIndexRemovedConvention, IIndexUniquenessChangedConvention, IKeyAddedConvention, IKeyRemovedConvention, IModelFinalizingConvention
Public Class ForeignKeyIndexConvention
Implements IEntityTypeBaseTypeChangedConvention, IForeignKeyAddedConvention, IForeignKeyPropertiesChangedConvention, IForeignKeyRemovedConvention, IForeignKeyUniquenessChangedConvention, IIndexAddedConvention, IIndexRemovedConvention, IIndexUniquenessChangedConvention, IKeyAddedConvention, IKeyRemovedConvention, IModelFinalizedConvention
Inheritance
ForeignKeyIndexConvention
Attributes
Implements

Remarks

See Model building conventions for more information and examples.

Constructors

Name Description
ForeignKeyIndexConvention(ProviderConventionSetBuilderDependencies)

Creates a new instance of ForeignKeyIndexConvention.

Properties

Name Description
Dependencies

Dependencies for this service.

Methods

Name Description
AreIndexedBy(IReadOnlyList<IConventionProperty>, Boolean, IReadOnlyList<IConventionProperty>, Boolean)

Returns a value indicating whether the given properties are already covered by an existing index.

CreateIndex(IReadOnlyList<IConventionProperty>, Boolean, IConventionEntityTypeBuilder)

Creates an IConventionIndex.

ProcessEntityTypeBaseTypeChanged(IConventionEntityTypeBuilder, IConventionEntityType, IConventionEntityType, IConventionContext<IConventionEntityType>)

Called after the base type of an entity type changes.

ProcessForeignKeyAdded(IConventionForeignKeyBuilder, IConventionContext<IConventionForeignKeyBuilder>)

Called after a foreign key is added to the entity type.

ProcessForeignKeyAdded(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Called after a foreign key is added to the entity type.

ProcessForeignKeyPropertiesChanged(IConventionForeignKeyBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IReadOnlyList<IConventionProperty>>)

Called after the foreign key properties or principal key are changed.

ProcessForeignKeyPropertiesChanged(IConventionRelationshipBuilder, IReadOnlyList<IConventionProperty>, IConventionKey, IConventionContext<IConventionRelationshipBuilder>)

Called after the foreign key properties or principal key are changed.

ProcessForeignKeyRemoved(IConventionEntityTypeBuilder, IConventionForeignKey, IConventionContext<IConventionForeignKey>)

Called after a foreign key is removed.

ProcessForeignKeyUniquenessChanged(IConventionForeignKeyBuilder, IConventionContext<Nullable<Boolean>>)

Called after the uniqueness for a foreign key is changed.

ProcessForeignKeyUniquenessChanged(IConventionRelationshipBuilder, IConventionContext<IConventionRelationshipBuilder>)

Called after the uniqueness for a foreign key is changed.

ProcessIndexAdded(IConventionIndexBuilder, IConventionContext<IConventionIndexBuilder>)

Called after an index is added to the entity type.

ProcessIndexRemoved(IConventionEntityTypeBuilder, IConventionIndex, IConventionContext<IConventionIndex>)

Called after an index is removed.

ProcessIndexUniquenessChanged(IConventionIndexBuilder, IConventionContext<IConventionIndexBuilder>)

Called after the uniqueness for an index is changed.

ProcessIndexUniquenessChanged(IConventionIndexBuilder, IConventionContext<Nullable<Boolean>>)

Called after the uniqueness for an index is changed.

ProcessKeyAdded(IConventionKeyBuilder, IConventionContext<IConventionKeyBuilder>)

Called after a key is added to the entity type.

ProcessKeyRemoved(IConventionEntityTypeBuilder, IConventionKey, IConventionContext<IConventionKey>)

Called after a key is removed from the entity type.

ProcessModelFinalized(IConventionModelBuilder, IConventionContext<IConventionModelBuilder>)

Called after a model is finalized.

ProcessModelFinalizing(IConventionModelBuilder, IConventionContext<IConventionModelBuilder>)

Called when a model is being finalized.

Applies to


Feedback

Was this page helpful?