[Solved] Entity Framework Core (EF 6) Error: Unable to track an entity of type 'YourModalName' because primary key property 'id' is null.



Question: How do you resolve: Unable to track an entity of type 'YourModalName' because primary key property 'id' is null. When developing in Asp.Net Core Entity Framework EF 6?

 

Answer: Look carefully, you might have created an ID property with a "string" property type. The solution is to change from "string" to "int". The error tells you that the id is empty hence you might have started looking for reasons why the "id" might be empty.