Implementing Undo/Redo feature for DbContext of Entity Framework
http://www.codeproject.com/Articles/474279/Implementing-Undo-Redo-feature-for-DbContext-of-En
I was curious about change tracking and property values of DbContext
and while playing with that I decided to write snapshot manager which would take snapshot of my each changes by storing entries And this manager also allow me to backward and forward my changes with DbContext
. The Undo and Redo features allow you to easily correct mistakes or based on some scenario, as well as free you to experiment with different routing and data mapping decisions. Undo reverses the last action you performed, and Redo undoes the last Undo action.
===============================================================
若 Dbcontext在请求期间公用一个的话,在savechanges()出现错误entityvalidationerrors的时候,会影响后面的正常的提交保存。 用上文提到的undo等可以解决。