Hi @خالد الريمي ,
It' s a EF problem not MVC.I think you need to add the [DatabaseGenerated(..)] annotation to indicate an IDENTITY column in the table.Just like this:
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
You need to either make sure the value in the object mapped to this column is not modified or marked as modified.
Best regards,
Yijing Sun
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.