Comparing Events and Rules
Rules and events are run when changes occur in a model. Rules are applied in a transaction when the change is occurring, and events are applied after changes in a transaction are committed.
You use events to track changes to the store, such as the name of an item that appears in a tool window in Visual Studio. You use rules to change the contents of the store.
Creating Custom Rules You can create a custom rule as a derived class from an abstract rule. You must also notify the framework about the custom rule. For more information, see How to: Create Custom Rules.
Subscribing to Events Before you can subscribe to an event, create an event handler and delegate. Then use the EventManagerDirectory property to subscribe to the event. For more information, see How to: Register to be Notified on an Event.
Undoing Changes When you undo a transaction, events are raised, but rules are not applied. If a rule changes a value and you undo that change, the value is reset to the original value during the undo action. When an event is raised, you must manually change the value back to its original value. To learn more about the undo action, see How to: Undo and Redo Changes Made to the Store.
Passing Event Arguments to Rules and Events Both events and rules are passed an EventArgs parameter that has information about how the model changed.