This article describes the undo feature implementation for Jasema 2 using the PostSharp framework. For a simple introduction, this is my article about AOP using PostSharp. You can also read an article on compile time validation of custom aspects on this blog.
In the previous post, we looked at how PostSharp’s
CompileTimeValidate
method can be overridden to make sure that it has been applied correctly in the code. What we did not do, however, was to look at the context in which these aspects can be used.
The example given previously is straight out of the source code for Jasema‘s undo feature. This sort of functionality is very, very, very useful in applications involving complex tasks such as drawing, or editing a document, but they can also be a pain to write – not only do you need to maintain a log of each action, but you also have to make sure that each log entry has a way of being rolled back. What follows is a brief description of the route we took when writing the implementation used in Jasema. It is essentially a bastardised command pattern implementation, with a fair sprinkling of AOP thrown in for extra added fun and games. Continue reading “Implementing the Undo feature for Jasema”