Delen via


IKey Interface

Definition

Represents a primary or alternate key on an entity type.

public interface IKey : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable
public interface IKey : Microsoft.EntityFrameworkCore.Infrastructure.IAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey
type IKey = interface
    interface IAnnotatable
type IKey = interface
    interface IReadOnlyKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
Public Interface IKey
Implements IAnnotatable
Public Interface IKey
Implements IAnnotatable, IReadOnlyKey
Derived
Implements

Remarks

See Modeling entity types and relationships for more information and examples.

Properties

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).

Item[String]

Gets the value of the annotation with the given name, returning null if it does not exist.

(Inherited from IReadOnlyAnnotatable)
Properties

Gets the properties that make up the key.

Methods

AddRuntimeAnnotation(String, Object)

Adds a runtime annotation to this object. Throws if an annotation with the specified name already exists.

(Inherited from IAnnotatable)
AnnotationsToDebugString(Int32)

Gets the debug string for all annotations declared on the object.

(Inherited from IReadOnlyAnnotatable)
FindAnnotation(String)

Gets the annotation with the given name, returning null if it does not exist.

(Inherited from IReadOnlyAnnotatable)
FindRuntimeAnnotation(String)

Gets the runtime annotation with the given name, returning null if it does not exist.

(Inherited from IAnnotatable)
FindRuntimeAnnotationValue(String)

Gets the value of the runtime annotation with the given name, returning null if it does not exist.

(Inherited from IAnnotatable)
GetAnnotation(String)

Gets the annotation with the given name, throwing if it does not exist.

(Inherited from IReadOnlyAnnotatable)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from IReadOnlyAnnotatable)
GetKeyType()

Returns the type of the key property for simple keys, or an object array for composite keys.

GetOrAddRuntimeAnnotationValue<TValue,TArg>(String, Func<TArg,TValue>, TArg)

Gets the value of the runtime annotation with the given name, adding it if one does not exist.

(Inherited from IAnnotatable)
GetPrincipalKeyValueFactory()

Gets a factory for key values based on the key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetPrincipalKeyValueFactory<TKey>()

Gets a factory for key values based on the key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetReferencingForeignKeys()

Gets all foreign keys that target a given primary or alternate key.

GetRuntimeAnnotations()

Gets all the runtime annotations on the current object.

(Inherited from IAnnotatable)
IsPrimaryKey()

Returns a value indicating whether the key is the primary key.

(Inherited from IReadOnlyKey)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from IAnnotatable)
SetRuntimeAnnotation(String, Object)

Sets the runtime annotation stored under the given key. Overwrites the existing annotation if an annotation with the specified name already exists.

(Inherited from IAnnotatable)
ToDebugString(MetadataDebugStringOptions, Int32)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

(Inherited from IReadOnlyKey)

Extension Methods

AnnotationsToDebugString(IAnnotatable, Int32)

Gets the debug string for all annotations declared on the object.

GetAnnotation(IAnnotatable, String)

Gets the annotation with the given name, throwing if it does not exist.

GetKeyType(IKey)

Returns the type of the key property for simple keys, or an object array for composite keys.

GetPrincipalKeyValueFactory<TKey>(IKey)

Gets a factory for key values based on the index key values taken from various forms of entity data.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetReferencingForeignKeys(IKey)

Gets all foreign keys that target a given primary or alternate key.

IsPrimaryKey(IKey)

Returns a value indicating whether the key is the primary key.

ToDebugString(IKey, MetadataDebugStringOptions, Int32)

Creates a human-readable representation of the given metadata.

Warning: Do not rely on the format of the returned string. It is designed for debugging only and may change arbitrarily between releases.

FindSharedObjectRootKey(IKey, StoreObjectIdentifier)

Finds the first IConventionKey that is mapped to the same constraint in a shared table-like object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

FindSharedObjectRootKey(IReadOnlyKey, StoreObjectIdentifier)

Finds the first IKey that is mapped to the same constraint in a shared table-like object.

This method is typically used by database providers (and other extensions). It is generally not used in application code.

GetDefaultName(IKey, StoreObjectIdentifier)

Returns the default key constraint name that would be used for this key for a particular table.

GetDefaultName(IKey)

Returns the default key constraint name that would be used for this key.

GetDefaultName(IReadOnlyKey, StoreObjectIdentifier)

Returns the default key constraint name that would be used for this key for a particular table.

GetDefaultName(IReadOnlyKey)

Returns the default key constraint name that would be used for this key.

GetMappedConstraints(IKey)

Gets the unique constraints to which the key is mapped.

GetName(IKey, StoreObjectIdentifier)

Returns the key constraint name for this key for a particular table.

GetName(IKey)

Returns the key constraint name for this key.

GetName(IReadOnlyKey, StoreObjectIdentifier)

Returns the key constraint name for this key for a particular table.

GetName(IReadOnlyKey)

Returns the key constraint name for this key.

Relational(IKey)

Gets the relational database specific metadata for a key.

GetFluentApiCalls(IKey, IAnnotationCodeGenerator)

Gets the fluent API calls to configure a key.

IsHandledByConvention(IKey)

Gets a value indicating whether the key would be configured by conventions.

Sqlite(IKey)

Gets the SQLite specific metadata for a key.

GetFillFactor(IReadOnlyKey, StoreObjectIdentifier)

Returns the fill factor that the key uses.

GetFillFactor(IReadOnlyKey)

Returns the fill factor that the key uses.

IsClustered(IKey, StoreObjectIdentifier)

Returns a value indicating whether the key is clustered.

IsClustered(IKey)

Returns a value indicating whether the key is clustered.

IsClustered(IReadOnlyKey, StoreObjectIdentifier)

Returns a value indicating whether the key is clustered.

IsClustered(IReadOnlyKey)

Returns a value indicating whether the key is clustered.

SqlServer(IKey)

Gets the SQL Server specific metadata for a key.

Applies to