Mark Tabor

Mark Tabor

  • 587
  • 2k
  • 465.4k

Getting error while saving records into the table

May 17 2022 5:13 AM

 I am using entity framwork and while saving record to my table I am getting below error message what would be the cause 

"The changes to the database were committed successfully, but an error occurred while updating the object context. The ObjectContext might be in an inconsistent state. Inner exception message: Saving or accepting changes failed because more than one entity of type 'APP_Application.Models.Employee_Log' have the same primary key value. Ensure that explicitly set primary key values are unique. Ensure that database-generated primary keys are configured correctly in the database and in the Entity Framework model. Use the Entity Designer for Database First/Model First configuration. Use the 'HasDatabaseGeneratedOption" fluent API or 'DatabaseGeneratedAttribute' for Code First configuration"

I am saving data in another table not in Employee_log but there is a trigger which fire when I do insertion on other table I check the employee_log table it is having unique primary key 


Answers (1)