IMutableKey Interface

Definition

Represents a primary or alternate key on an entity.

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

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

AddAnnotation(String, Object)

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

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

Adds annotations to an object.

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

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

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

(Inherited from IKey)
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)
RemoveAnnotation(String)

Removes the given annotation from this object.

(Inherited from IMutableAnnotatable)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from IAnnotatable)
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 IMutableAnnotatable)
SetOrRemoveAnnotation(String, Object)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists. Removes the existing annotation if null is supplied.

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

AddAnnotations(IMutableAnnotatable, IEnumerable<IAnnotation>)

Adds annotations to an object.

GetAnnotation(IMutableAnnotatable, String)

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

GetOrAddAnnotation(IMutableAnnotatable, String, String)

Gets the existing annotation with a given key, or adds a new annotation if one does not exist.

SetOrRemoveAnnotation(IMutableAnnotatable, String, Object)

Sets the annotation stored under the given name. Overwrites the existing annotation if an annotation with the specified name already exists. Removes the existing annotation if null is supplied.

GetReferencingForeignKeys(IMutableKey)

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

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(IMutableKey, StoreObjectIdentifier)

Finds the first IMutableKey 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)

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

GetDefaultName(IKey, 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.

GetDefaultName(IReadOnlyKey, StoreObjectIdentifier)

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

GetMappedConstraints(IKey)

Gets the unique constraints to which the key is mapped.

GetName(IKey)

Returns the key constraint name for this key.

GetName(IKey, StoreObjectIdentifier)

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

GetName(IReadOnlyKey)

Returns the key constraint name for this key.

GetName(IReadOnlyKey, StoreObjectIdentifier)

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

SetName(IMutableKey, String)

Sets the key constraint name for this key.

Relational(IKey)

Gets the relational database specific metadata for a key.

Relational(IMutableKey)

Gets the relational database specific metadata for a key.

Sqlite(IKey)

Gets the SQLite specific metadata for a key.

Sqlite(IMutableKey)

Gets the SQLite specific metadata for a key.

IsClustered(IKey)

Returns a value indicating whether the key is clustered.

IsClustered(IKey, StoreObjectIdentifier)

Returns a value indicating whether the key is clustered.

IsClustered(IReadOnlyKey)

Returns a value indicating whether the key is clustered.

IsClustered(IReadOnlyKey, StoreObjectIdentifier)

Returns a value indicating whether the key is clustered.

SetIsClustered(IMutableKey, Nullable<Boolean>)

Sets a value indicating whether the key is clustered.

SqlServer(IKey)

Gets the SQL Server specific metadata for a key.

SqlServer(IMutableKey)

Gets the SQL Server specific metadata for a key.

Applies to