Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

EntityEntry.IsKeySet Property

Definition

Namespace:
Microsoft.EntityFrameworkCore.ChangeTracking
Assembly:
Microsoft.EntityFrameworkCore.dll
Package:
Microsoft.EntityFrameworkCore v1.0.6
Package:
Microsoft.EntityFrameworkCore v1.1.6
Package:
Microsoft.EntityFrameworkCore v10.0.0
Package:
Microsoft.EntityFrameworkCore v2.0.3
Package:
Microsoft.EntityFrameworkCore v2.1.11
Package:
Microsoft.EntityFrameworkCore v2.2.6
Package:
Microsoft.EntityFrameworkCore v3.0.0
Package:
Microsoft.EntityFrameworkCore v3.1.0
Package:
Microsoft.EntityFrameworkCore v5.0.0
Package:
Microsoft.EntityFrameworkCore v6.0.0
Package:
Microsoft.EntityFrameworkCore v7.0.0
Package:
Microsoft.EntityFrameworkCore v8.0.0
Package:
Microsoft.EntityFrameworkCore v9.0.0
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs
Source:
EntityEntry.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

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

Remarks

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


Feedback

Was this page helpful?