In my application, I have a method that I call from code which seeds the database and this works fine.
I Have just created a new big method which also adds a lot more data to the database.
When I call this, it appears to work fine the first time it has run, but, if I run it again within a few minutes of the previous attempt, I get the following error:
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: AcceptChanges cannot continue because the object's key values conflict with another object in the ObjectStateManager. Make sure that the key values are unique before calling AcceptChanges.
I am unsure how to fix this, can anyone advise anything? (other than not to run this within a few minutes of the last attempt!).