EntityEntry.IsKeySet Property


Gets a value indicating if the key values of this entity have been assigned a value.

public virtual bool IsKeySet { get; }
member this.IsKeySet : bool
Public Overridable ReadOnly Property IsKeySet As Boolean

Property Value


For keys with store-generated properties (e.g. mapping to Identity columns), the return value will be false if any of the store-generated properties have the CLR default value.

For keys without any store-generated properties, the return value will always be true since any value is considered a valid key value.

See EF Core change tracking for more information and examples.

Applies to