Interface IConventionKey
- Namespace
- Microsoft.EntityFrameworkCore.Metadata
- Assembly
- Microsoft.EntityFrameworkCore.dll
Represents a primary or alternate key on an entity.
public interface IConventionKey : IReadOnlyKey, IConventionAnnotatable, IReadOnlyAnnotatable
- Inherited Members
- Extension Methods
Remarks
This interface is used during model creation and allows the metadata to be modified. Once the model is built, IKey represents a read-only view of the same metadata.
See Model building conventions for more information and examples.
Properties
Builder
Gets the builder that can be used to configure this key.
IConventionKeyBuilder Builder { get; }
Property Value
Exceptions
- InvalidOperationException
If the index has been removed from the model.
DeclaringEntityType
Gets the entity type the key is defined on. This may be different from the type that Properties are defined on when the key is defined a derived type in an inheritance hierarchy (since the properties may be defined on a base type).
IConventionEntityType DeclaringEntityType { get; }
Property Value
Properties
Gets the properties that make up the key.
IReadOnlyList<IConventionProperty> Properties { get; }
Property Value
Methods
GetConfigurationSource()
Returns the configuration source for this key.
ConfigurationSource GetConfigurationSource()
Returns
- ConfigurationSource
The configuration source.
GetReferencingForeignKeys()
Gets all foreign keys that target a given primary or alternate key.
IEnumerable<IConventionForeignKey> GetReferencingForeignKeys()
Returns
- IEnumerable<IConventionForeignKey>
The foreign keys that reference the given key.