2021 Class
Changes 0
C

SubTransaction

Description:
Sub-transactions are objects that provide control over a subset of changes in a document.
Remarks:
A Sub-transaction can only be active as a part of an open transaction. Sub-transactions may be nested inside each other, but with the restriction that every nested sub-transaction is entirely contained (opened and closed) in the parent sub-transaction.

If a sub-transaction was started and not committed or rolled back by the time the SubTransaction object is about to be disposed, the destructor will roll back the sub-transaction automatically, thus all changes made to the document during the sub-transaction will be discarded. It is not recommended to rely on this default behavior though. Instead, it is advised to always call either Commit or RollBack explicitly before the sub-transaction object gets disposed. Please note that unless invoked explicitly the actual destruction of an object in managed code might not happen until the object is collected by the garbage collector.

Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.SubTransaction
public class SubTransaction : IDisposable
Name Return Type Description
C SubTransaction(Document) None Instantiates a sub-transaction object
Name Return Type Description
M Commit() TransactionStatus Commits all changes made to the model made during the sub-transaction.
M Dispose() None Releases all resources used by the
M GetStatus() TransactionStatus Returns the current status of the sub-transaction.
M HasEnded() bool Determines whether the sub-transaction has ended already.
M HasStarted() bool Determines whether the sub-transaction has been started yet.
M RollBack() TransactionStatus Discards all changes made to the model during the sub-transaction.
M Start() TransactionStatus Starts the sub-transaction.
Name Return Type Description
P IsValidObject bool Specifies whether the .NET object represents a valid Revit entity.