Transactions
§To start a transaction, use Databases’ StartTransaction()
§
§ For example:
§ Dim db As Database = HostApplicationServices.WorkingDatabase() ‘Get the current db used by AutoCAD
§
§ Dim trans As Transaction = db.TransactionManager.StartTransaction() ' begin the transaction
§
§To commit a transaction, use transaction’s Commit()
§To Abort a transaction, use transaction’s Abort()
§When done with a transaction it must be:
     explicitly disposed!
§
§
Here we see an example of creating a transaction. After we get the DataBase, we declare a transaction named trans. It is created using the StartTransaction method of the TransactionManager of that Database. A transaction has a Commit method that we use if everything went fine. If there was a problem we will call the Abort method. Always remember to explicitly dispose the Transaction. This is often done in the finally block of a Try Catch block.