This is the online documentation for PostSharp 5.0.
Download PDF or CHM. Go to v4.3 or v5.0

Undo/Redo

Most business application users are familiar with applications that have the ability to undo and redo changes that they have made. It’s not common to see this functionality in custom built applications because it is quite difficult to do. Despite this difficulty, undo/redo is consistently mentioned on the top of users' wish list.

The RecordableAttribute aspect makes it much easier to add undo/redo to your application by automatically appending changes done on your object model to a Recorder that you can then bind to your user interface. Unlike other approaches to undo/redo, the RecordableAttribute aspect only requires minimal changes to your source code.

In this chapter

Section

Description

Making Your Model Recordable

The first step is to make your model classes This section shows how to add the RecordableAttribute aspect to the model classes to enable the undo/redo functionality.

Adding Undo/Redo to the User Interface

This section describes how to expose the undo/redo functionality to the application's users.

Customizing Undo/Redo Operation Names

This section shows how to group changes into logical operations and give them a name that is meaningful to the application's users.

Assigning Recorders Manually

This section explains how to customize the assignment of recordable objects to recorders.

Adding Callbacks on Undo and Redo

This section shows how to execute custom logic when undo/redo operations occur in a recordable object.

Understanding the Recordable Aspect

This section describes the concepts and architecture of the RecordableAttribute aspect.