2025.3 Class
Changes 0
C

Transaction

Description:
Transactions are context-like objects that guard any changes made to a Revit model
Remarks:

Any change to a document can only be made while there is an active transaction open for that document. Changes do not become part of the document until the active transaction is committed. Consequently, all changes made in a transaction can be rolled back either explicitly or implicitly by the transaction's destructor.

A document can have only one transaction open at any given time.

Transactions cannot be started when the document is in read-only mode, either permanently or temporarily. See the Document class methods IsReadOnly and IsModifiable for more details.

Transactions in linked documents are not permitted, for linked documents are not allowed to be modified.

If a transaction was started and not finished yet by the time the Transaction object is about to be disposed, the default destructor will roll it back automatically, thus all changes made to the document while this transaction was open 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 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.Transaction
public class Transaction : IDisposable
Name Return Type Description Inherited From
C Transaction(Document) None Instantiates a transaction object.
C Transaction(Document, String) None Instantiates a transaction object
Name Return Type Description Inherited From
M Commit() TransactionStatus Commits all changes made to the model during the transaction.
M Commit(FailureHandlingOptions) TransactionStatus Commits all changes made to the model during the transaction.
M Dispose() None Releases all resources used by the Transaction
M Equals None Determines whether the specified object is equal to the current object. (Inherited from Object ) Object
M GetFailureHandlingOptions() FailureHandlingOptions Returns the current failure handling options.
M GetHashCode None Serves as the default hash function. (Inherited from Object ) Object
M GetName() String Returns the transaction's name.
M GetStatus() TransactionStatus Returns the current status of the transaction.
M GetType None Gets the Type of the current instance. (Inherited from Object ) Object
M HasEnded() Boolean Determines whether the transaction has ended already.
M HasStarted() Boolean Determines whether the transaction has been started yet.
M RollBack() TransactionStatus Rolls back all changes made to the model during the transaction.
M RollBack(FailureHandlingOptions) TransactionStatus Rolls back all changes made to the model during the transaction.
M SetFailureHandlingOptions(FailureHandlingOptions) None Sets options for handling failures to be used when the transaction is being committed or rolled back.
M SetName(String) None Sets the transaction's name.
M Start() TransactionStatus Starts the transaction.
M Start(String) TransactionStatus Starts the transaction with an assigned name.
M ToString None Returns a string that represents the current object. (Inherited from Object ) Object
Name Return Type Description Inherited From
P IsValidObject Boolean Specifies whether the .NET object represents a valid Revit entity.