A transaction enables you to group changes. It also keeps track of the actions that are performed in a transaction so that they can be undone at a later stage.
Changes to the store must be done in a transaction. Changes to the store are made only if the transaction commits. A transaction can have the store accept the changes when the local transaction is committed or when the top-level transaction is committed. Local transactions are nested in a top-level transaction. A nested transaction must commit or roll back before the next top-level transaction can commit or roll back. For more information, see the example for the TransactionDepth property.
A transaction also keeps track of the actions that have occurred. This enables a group of actions to be undone or redone at a later stage with the UndoManager property.
A transaction should be disposed. This can be done by using the Dispose method or by creating the transaction in a Using construct. If the transaction has not been committed when it is disposed, the transaction is automatically rolled back and any changes are canceled.