Transaction - Opening an Object
• Use transaction’s GetObject to open an object
§The first parameter is the ObjectId
§Second parameter is the open mode
§ForRead – Access but not Modify
§ForWrite – Modify and Access
§ForNotify – When the object is notifying
Dim bt As BlockTable = trans.GetObject( _
db.BlockTableId, _
OpenMode.ForWrite _
)
We use the GetObject method of the Transaction to Open objects. We use an ObjectId with this method. We also need to set whether to open the object for Read, Write or Notify. In many cases you will want to open the object for Read, test some its properties and then Upgrade the object to Open for write if you need to make changes to the object. This example shows how to open the BlockTable for write. Notice that the Database has a BlockTableId property that we can use for the ObjectId.