Discards all changes made to the model during the sub-transaction.
Namespace: Autodesk.Revit.DBAssembly: RevitAPI (in RevitAPI.dll) Version: 21.0.0.0 (21.1.1.109)
Since: 2011
Syntax
C# |
---|
public TransactionStatus RollBack() |
Visual Basic |
---|
Public Function RollBack As TransactionStatus |
Visual C++ |
---|
public: TransactionStatus RollBack() |
Return Value
If finished successfully, this method returns TransactionStatus.RolledBack.
Remarks
The parent transaction (or a parent sub-transaction, if any) can still be committed, but the changes rolled back by this method will not be part of the committed transaction.
RollBack can be called only when all inner sub-transaction, if any, are finished, i.e. they were either committed or rolled back. If there is still a sub-transaction open, an attempt to roll this outer sub-transaction back will cause an exception.
Exceptions
Exception | Condition |
---|---|
Autodesk.Revit.Exceptions..::..InvalidOperationException | A sub-transaction can only be active inside an open Transaction. -or- The sub-transaction's current status is not TransactionStatus.Started, therefore it may not be committed or rolled back. |