Share via


IReadOnlyKey Interface

Definition

Represents a primary or alternate key on an entity type.

public interface IReadOnlyKey : Microsoft.EntityFrameworkCore.Infrastructure.IReadOnlyAnnotatable
type IReadOnlyKey = interface
    interface IReadOnlyAnnotatable
Public Interface IReadOnlyKey
Implements IReadOnlyAnnotatable
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

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)
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)
GetReferencingForeignKeys()

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

IsPrimaryKey()

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

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.

Extension Methods

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

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.

IsClustered(IReadOnlyKey, StoreObjectIdentifier)

Returns a value indicating whether the key is clustered.

IsClustered(IReadOnlyKey)

Returns a value indicating whether the key is clustered.

Applies to