Skip to content

TransactionGroup

Public Class

Transaction groups aggregate a number of transactions.

Inheritance Hierarchy

System.Object
Autodesk.Revit.DB.TransactionGroup

Namespace: Autodesk.Revit.DB

Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)

Syntax

public class TransactionGroup : IDisposable

The TransactionGroup type exposes the following members.

Constructors

Name

Description


Public Method
TransactionGroup(Document)

Constructs a transaction group object.


Public Method
TransactionGroup(Document, String)

It constructs a transaction group object


Properties

Name

Description


Public Property
IsFailureHandlingForcedModal

Forces all transactions finished inside this group to use modal failure handling regardless of what failure handling options are set for those transactions.


Public Property
IsValidObject

Specifies whether the .NET object represents a valid Revit entity.


Methods

Name

Description


Public Method
Code Example
Assimilate

Assimilates all inner transactions by merging them into a single undo item.


Public Method
Code Example
Commit

Commits the transaction group.


Public Method

Releases all resources used by the TransactionGroup


Public Method

Equals

Determines whether the specified object is equal to the current object.
(Inherited from Object)


Public Method

GetHashCode

Serves as the default hash function.
(Inherited from Object)


Public Method

Returns the transaction group’s name. It could be an empty string.


Public Method

Gets the current status of the transaction group.


Public Method

GetType

Gets the Type of the current instance.
(Inherited from Object)


Public Method
HasEnded

Determines whether the transaction group has ended already.


Public Method
HasStarted

Determines whether the transaction has been started yet.


Public Method
RollBack

Rolls back the transaction group, which effectively undoes all transactions committed inside the group.


Public Method
SetName

Sets the transaction group’s name.


Public Method
Start.

Starts the transaction group


Public Method
Start(String)

Starts the transaction group with an assigned name.


Public Method

ToString

Returns a string that represents the current object.
(Inherited from Object)


Remarks

A transaction group controls whether transactions committed inside the group should stay committed or should be all discarded. If the group is committed, all the transactions remain committed, but if the transaction group is rolled back instead, all the inner, already committed transactions will be undone (and removed).

There are two ways of committing a group - Commit and Assimilate. By committing, all transactions committed inside a group stay as they are, while by assimilating, all inner transactions will be merged into a single transaction.

A transaction group can only be started when no transaction is active, and must be closed only after the last transaction started inside the group is finished, i.e. after it was either committed or rolled back.

Transaction groups may be nested inside each other with the restriction that every nested transaction group is entirely contained (opened and closed) in the parent transaction group.

If a transaction group was started and not finished yet by the time the TransactionGroup object is about to be, the default destructor will roll it back automatically, thus all changes made to the document while this transaction group 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., RollBack., or Assimilate. explicitly before the group object gets destroyed. 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.