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


Edit this Article
primary key property 'id' is null Technology published
Was this page helpful?
Yes Yes! this solution to the problem was helpful. No No! this solution to the problem was not helpful.. Leave ErnesTech Feedback.Feedback
If you log in, you will be notified when someone leaves a comment.

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

Your Session is Ending
Login to Continue

© 2021 - ErnesTech - Privacy