RuntimeKey Class

Definition

Represents a primary or alternate key on an entity type.

public class RuntimeKey : Microsoft.EntityFrameworkCore.Infrastructure.AnnotatableBase, Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeKey
type RuntimeKey = class
    inherit AnnotatableBase
    interface IRuntimeKey
    interface IKey
    interface IReadOnlyKey
    interface IReadOnlyAnnotatable
    interface IAnnotatable
Public Class RuntimeKey
Inherits AnnotatableBase
Implements IRuntimeKey
Inheritance
RuntimeKey
Implements
IAnnotatable IReadOnlyAnnotatable IKey Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeKey IReadOnlyKey

Remarks

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

Constructors

RuntimeKey(IReadOnlyList<RuntimeProperty>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Properties

DebugView

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

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

IdentityMapFactory

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

IsReadOnly

Indicates whether the current object is read-only.

(Inherited from AnnotatableBase)
Item[String]

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

(Inherited from AnnotatableBase)
Properties

Gets the properties that make up the key.

ReferencingForeignKeys

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

Methods

AddAnnotation(String, Annotation)

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

(Inherited from AnnotatableBase)
AddAnnotation(String, Object)

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

(Inherited from AnnotatableBase)
AddAnnotations(IEnumerable<IAnnotation>)

Adds annotations to this object.

(Inherited from AnnotatableBase)
AddAnnotations(IReadOnlyDictionary<String,Object>)

Adds annotations to this object.

(Inherited from AnnotatableBase)
AddRuntimeAnnotation(String, Annotation)

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

(Inherited from AnnotatableBase)
AddRuntimeAnnotation(String, Object)

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

(Inherited from AnnotatableBase)
AddRuntimeAnnotations(IEnumerable<Annotation>)

Adds runtime annotations to this object.

(Inherited from AnnotatableBase)
AddRuntimeAnnotations(IReadOnlyDictionary<String,Object>)

Adds runtime annotations to this object.

(Inherited from AnnotatableBase)
CreateAnnotation(String, Object)

Creates a new annotation.

(Inherited from AnnotatableBase)
CreateRuntimeAnnotation(String, Object)

Creates a new runtime annotation.

(Inherited from AnnotatableBase)
EnsureMutable()

Throws if the model is read-only.

(Inherited from AnnotatableBase)
EnsureReadOnly()

Throws if the model is not read-only.

(Inherited from AnnotatableBase)
FindAnnotation(String)

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

(Inherited from AnnotatableBase)
FindRuntimeAnnotation(String)

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

(Inherited from AnnotatableBase)
GetAnnotation(String)

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

(Inherited from AnnotatableBase)
GetAnnotations()

Gets all annotations on the current object.

(Inherited from AnnotatableBase)
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 AnnotatableBase)
GetRuntimeAnnotations()

Gets all runtime annotations on the current object.

(Inherited from AnnotatableBase)
OnAnnotationSet(String, Annotation, Annotation)

Called when an annotation was set or removed.

(Inherited from AnnotatableBase)
RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from AnnotatableBase)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from AnnotatableBase)
SetAnnotation(String, Annotation, Annotation)

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

(Inherited from AnnotatableBase)
SetAnnotation(String, Object)

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

(Inherited from AnnotatableBase)
SetIdentityMapFactory(Func<Boolean,IIdentityMap>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

SetPrincipalKeyValueFactory<TKey>(IPrincipalKeyValueFactory<TKey>)

This is an internal API that supports the Entity Framework Core infrastructure and not subject to the same compatibility standards as public APIs. It may be changed or removed without notice in any release. You should only use it directly in your code with extreme caution and knowing that doing so can result in application failures when updating to a new Entity Framework Core release.

SetRuntimeAnnotation(String, Annotation, Annotation)

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

(Inherited from AnnotatableBase)
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 AnnotatableBase)
ToString()

Returns a string that represents the current object.

Explicit Interface Implementations

IAnnotatable.AddRuntimeAnnotation(String, Object)

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

(Inherited from AnnotatableBase)
IAnnotatable.FindRuntimeAnnotation(String)

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

(Inherited from AnnotatableBase)
IAnnotatable.GetRuntimeAnnotations()

Gets all the runtime annotations on the current object.

(Inherited from AnnotatableBase)
IAnnotatable.RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from AnnotatableBase)
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 AnnotatableBase)
IKey.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).

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

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

IKey.Properties

Gets the properties that make up the key.

IReadOnlyAnnotatable.FindAnnotation(String)

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

(Inherited from AnnotatableBase)
IReadOnlyAnnotatable.GetAnnotations()

Gets all annotations on the current object.

(Inherited from AnnotatableBase)
IReadOnlyAnnotatable.Item[String]

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

(Inherited from AnnotatableBase)
IReadOnlyKey.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).

IReadOnlyKey.GetReferencingForeignKeys()

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

IReadOnlyKey.Properties

Gets the properties that make up the key.

IRuntimeKey.GetIdentityMapFactory() Microsoft.EntityFrameworkCore.Metadata.Internal.IRuntimeKey.GetIdentityMapFactory

Extension Methods

AnnotationsToDebugString(IAnnotatable, Int32)

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

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.

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.

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.

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.

Applies to