Attching Error while updating the record with primarykey option of the UpdateGeneric method.

Feb 19, 2015 at 5:49 PM
Edited Feb 19, 2015 at 5:50 PM
As per your documentation i used this method handler.UpdateGeneric(myEntity, entityKey) to update my record but i got the following error.

Attaching an entity of type 'Model' failed because another entity of the same type already has the same primary key value. This can happen when using the 'Attach' method or setting the state of an entity to 'Unchanged' or 'Modified' if any entities in the graph have conflicting key values. This may be because some entities are new and have not yet received database-generated key values. In this case use the 'Add' method or the 'Added' entity state to track the graph and then set the state of non-new entities to 'Unchanged' or 'Modified' as appropriate.

what i did is that first i loaded the record using the GetFirstGeneric method in my Get Edit action and then in my post Edit action i tried to save it using the handler.UpdateGeneric(myEntity, entityKey) method. I hope i explained my self here please bare with me if i am making not much sense.

By the way you done excellent job with the framework i am really enjoying working with it. Thanks