Empty GUID when adding new entity

Markus Kolbeck
1 min readSep 25, 2018

--

Using the EntityFramework (EF) in a Microsoft Visual Studio ASP.NET project, you can add new entities (rows) within an SQL table.

In case you are using GUIDs as the primary key (and not integer values), newly created rows could be created with an empty GUID, i.e.

{00000000–0000–0000–0000–000000000000}

If that is the case, you might want to check the setting “StoreGeneratedPattern” for that column in the Model Browser or Visual Studio.

If it is not set to “Identity” you might want to do so.

--

--