AcceptChanges cannot continue because the object's key values conflict with another object in the ObjectStateManager

I had the exact same scenario with Entity Model based on Oracle database. The implementation of Identity is done by trigger so when adding the tables to the model it does not set the StoreGenertedPattern property of the identity column to Identity since it doens't aware that this column is identity.

There is a need to open model editor, locate the entity in the model, click on the key column and set the StoreGenertedPattern property to 'Identity' manually.


The closest I can come to finding an answer is:

Because Oracle uses a Sequence + Trigger to make "Auto Ident" values, it seems like when the entity framework adds an object at saves it, the value return is still 0, because the trigger/sequence haven't updated it yet.

Because of the 0 number, the ObjectMannager will think that multiple objects with the entity key of 0 are in conflict.

I don't have a "bullet proof" solutions, but have rewritten my solutions to handle it another way.

\T