I'm trying to save an entity to the database using entity framework. I have this code which handles the update of the object:
I am assuming that the entity is already attached by being a result of a previous query, or by adding it as a new entity via
When you attached the entity via
Attach, the state was changed to Unchanged.
Quoting from this reference:
Note that entities that are already in the context in some other state will have their state set to Unchanged
Since the object was already in the context, you don't have to attach it. Simply modify the entity and call