Declarative Transactions

As you know, a number of COM+ features can be set through declarative attributes. One is setting transactions at the component level, known as declarative transactions. You can set the transactioning attribute of each component by using the component’s Transactions tab in the Component Services administration program. The options are Disabled, Not Supported, Supported, Required, and Requires New. Through this declarative property, components decide whether they wish to participate in the outcome of the transaction. Every object that wants to participate in a transaction has one vote. All operations that the object performs occur during a transaction. At the end of the operation, all the votes are collected. Then the system either aborts the transaction or commits the transaction. You have to know when the transaction begins, when the transaction ends, what objects participate in the transaction, and how the components vote on the outcome of the transaction.

Declarative transactions differ from local transactions in several ways. First, when you use declarative transactions, you do not call BeginTrans, CommitTrans, or RollbackTrans. Your code never manages the physical transaction directly. You specify the transactional requirements of your component through declarative properties. COM+ will begin the physical transaction when needed. Your code will simply vote on the outcome of the transaction. At the end, COM+ will collect all the votes and call CommitTrans ...

Get COM+ Programming with Visual Basic now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.