Home > Articles > Details

[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?

 


Please Login to see the rest of the answer
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.


If you log in, you will be notified when someone leaves a comment.

Other users would like to know if this solution helped you.


© 2022 - ErnesTech - Privacy