Rolls back an explicit transaction to its starting point, discarding any changes made within it.
All data modifications made since the ExplicitUnitOfWork.BeginTransaction method call can be committed (ExplicitUnitOfWork.CommitTransaction, ExplicitUnitOfWork.CommitTransactionAsync, UnitOfWork.CommitChanges, or UnitOfWork.CommitChangesAsync), or discarded (RollbackTransaction). Disposing of an explicit unit of work automatically rolls back any pending data modifications.
Calling the RollbackTransaction method performs the following:
- Discards all data modifications via the Session.DropChanges method call.
- Raises the Session.BeforeRollbackTransaction event. Once an explicit transaction is rolled back, the Session.AfterRollbackTransaction event is raised.
An object's state modified within a transaction is not automatically returned to its former state by the RollbackTransaction method call. In order to refresh the object's state, use the XPBaseObject.Reload method.