Table of Contents

Interface IMutableKey

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

Represents a primary or alternate key on an entity.

public interface IMutableKey : IReadOnlyKey, IMutableAnnotatable, IReadOnlyAnnotatable
Inherited Members
Extension Methods

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

IMutableEntityType DeclaringEntityType { get; }

Property Value

IMutableEntityType

Properties

Gets the properties that make up the key.

IReadOnlyList<IMutableProperty> Properties { get; }

Property Value

IReadOnlyList<IMutableProperty>

Methods

GetReferencingForeignKeys()

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

IEnumerable<IMutableForeignKey> GetReferencingForeignKeys()

Returns

IEnumerable<IMutableForeignKey>

The foreign keys that reference the given key.