Udostępnij za pośrednictwem


IConventionKey Interface

Definition

Represents a primary or alternate key on an entity.

public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IKey
public interface IConventionKey : Microsoft.EntityFrameworkCore.Metadata.IConventionAnnotatable, Microsoft.EntityFrameworkCore.Metadata.IReadOnlyKey
type IConventionKey = interface
    interface IConventionAnnotatable
    interface IAnnotatable
    interface IKey
type IConventionKey = interface
    interface IReadOnlyKey
    interface IReadOnlyAnnotatable
    interface IConventionAnnotatable
Public Interface IConventionKey
Implements IConventionAnnotatable, IKey
Public Interface IConventionKey
Implements IConventionAnnotatable, 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 Model building conventions for more information and examples.

Properties

Builder

Gets the builder that can be used to configure this key.

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

IsInModel

Indicates whether this object is in a model, i.e. hasn't been removed from one.

(Inherited from IConventionAnnotatable)
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, Boolean)

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

(Inherited from IConventionAnnotatable)
AddAnnotations(IEnumerable<IConventionAnnotation>, Boolean)

Adds annotations to an object.

(Inherited from IConventionAnnotatable)
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)
GetConfigurationSource()

Returns the configuration source for this key.

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 annotation with the given name from this object.

(Inherited from IConventionAnnotatable)
RemoveRuntimeAnnotation(String)

Removes the given runtime annotation from this object.

(Inherited from IAnnotatable)
SetAnnotation(String, Object, Boolean)

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

(Inherited from IConventionAnnotatable)
SetOrRemoveAnnotation(String, Object, Boolean)

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

AddAnnotations(IConventionAnnotatable, IEnumerable<IConventionAnnotation>, Boolean)

Adds annotations to an object.

GetAnnotation(IConventionAnnotatable, String)

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

SetOrRemoveAnnotation(IConventionAnnotatable, String, Object, Boolean)

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

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

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

GetNameConfigurationSource(IConventionKey)

Gets the ConfigurationSource for the constraint name.

SetName(IConventionKey, String, Boolean)

Sets the key constraint name for this key.

GetFillFactor(IReadOnlyKey, StoreObjectIdentifier)

Returns the fill factor that the key uses.

GetFillFactor(IReadOnlyKey)

Returns the fill factor that the key uses.

GetFillFactorConfigurationSource(IConventionKey)

Returns the ConfigurationSource for whether the key uses the fill factor.

GetIsClusteredConfigurationSource(IConventionKey)

Gets the ConfigurationSource for whether the key is clustered.

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.

SetFillFactor(IConventionKey, Nullable<Int32>, Boolean)

Sets a value for fill factor the key uses.

SetIsClustered(IConventionKey, Nullable<Boolean>, Boolean)

Sets a value indicating whether the key is clustered.

Applies to