I have an observable collection that is bound to a datagrid. I have a templated column that contains a "Delete" button for each row. When the user clicks the "Delete" button for a specific row the entity is "marked" for deletion. Programmatically I do this with the following line:
entity.EntityAspect.Delete();
Eventually when the user clicks a "Save" button the entity is truly deleted from the database.
My question is, once a row in the datagrid is marked for deletion I would like to be able to allow the user to click the "Delete" button again to "undo" the delete operation.
How do I achieve this?
I was looking at
entity.EntityAspect.AcceptChanges()
this sets the state of the entity to "Detached" though...I want set the state of the entity back to "Unchanged" as if it was never touched at all but EntityState is read only.