Transaction attributes
Every transactional object has a transaction attribute that is recorded in the MTS catalog or that is registered with COM+.
Delphi lets you set the transaction attribute at design time using the Transactional Object wizard or the Type Library editor.
Each transaction attribute can be set to these settings:
Requires a transaction
Requires a new transaction
Supports transactions
Transactions Ignored
Does not support transactions
Objects must execute within the scope of a transaction. When a new object is created, its object context inherits the transaction from the context of the client. If the client does not have a transaction context, a new one is automatically created.
Objects must execute within their own transactions. When a new object is created, a new transaction is automatically created for the object, regardless of whether its client has a transaction. An object never runs inside the scope of its client's transaction. Instead, the system always creates independent transactions for the new objects.
Objects can execute within the scope of their client's transactions. When a new object is created, its object context inherits the transaction from the context of the client. This enables multiple objects to be composed in a single transaction. If the client does not have a transaction, the new context is also created without one.
Objects do not run within the scope of transactions. When a new object is created, its object context is created without a transaction, regardless of whether the client has a transaction. This setting is only available under COM+.
The meaning of this setting varies, depending on whether you install the object under MTS or COM+. Under MTS, this setting has the same meaning as Transactions Ignored under COM+. Under COM+, not only is the object context created without a transaction, this setting prevents the object from being activated if the client has a transaction.
Setting the transaction attribute
You can set a transaction attribute when you first create a transactional object using the Transactional Object wizard.
You can also set (or change) the transaction attribute using the Type Library editor. To change the transaction attribute in the Type Library editor,
1 Choose View I Type Library to open the Type Library editor.
2 Select the class corresponding to the transactional object.
3 Click the COM+ tab and choose the desired transaction attribute.
Warning When you set the transaction attribute, Delphi inserts a special GUID for the specified attribute as custom data in the type library. This value is not recognized outside of Delphi. Therefore, it only has an effect if you install the transactional object from the IDE. Otherwise, a system administrator must set this value using the MTS Explorer or COM+ Component Manager.
Note: If the transactional object is already installed, you must first uninstall the object and reinstall it when changing the transaction attribute. Use RunI Install MTS objects or Run I Install COM+ objects to do so.
Post a comment