Commit Method


Commits all changes made to the model made during the sub-transaction.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2011

Syntax

C#
public TransactionStatus Commit()
Visual Basic
Public Function Commit As TransactionStatus
Visual C++
public:
TransactionStatus Commit()

Return Value

If finished successfully, this method returns TransactionStatus.Committed

Remarks

The changes are not permanently committed to the document yet. They will be committed only when the active transaction is committed. If the transaction is rolled back instead, the changes committed during this sub-transaction will be discarded.

Commit can be called only when all inner sub-transactions, if any, are already finished, i.e. they were either committed or rolled back. If there is still a sub-transaction open, an attempt to commit this outer sub-transaction 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.

See Also