ContextUtil::MyTransactionVote Property
Gets or sets the consistent bit in the COM+ context.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
public: property TransactionVote MyTransactionVote { static TransactionVote get(); static void set(TransactionVote value); }
Property Value
Type: System.EnterpriseServices::TransactionVoteOne of the TransactionVote values, either Commit or Abort.
| Exception | Condition |
|---|---|
| COMException | There is no COM+ context available. |
| PlatformNotSupportedException | The platform is not Windows 2000 or later. |
When MyTransactionVote is set to Commit, the COM+ consistent bit is set to true and the COM+ context votes to commit the transaction. If MyTransactionVote is set to Abort, the consistent bit is set to false and the COM+ context votes to abort the transaction. The default value of the consistent bit is true.
The consistent bit casts a vote to commit or abort the transaction in which it executes, and the done bit finalizes the vote. COM+ inspects the consistent bit when the done bit is set to true on a method call return or when the object deactivates. Although an object's consistent bit can change repeatedly within each method call, only the last change counts.
The following code example demonstrates how to use MyTransactionVote property to create a transactional ServicedComponent.
[assembly:System::Reflection::AssemblyKeyFile("Transaction.snk")]; [Transaction] public ref class TransactionalComponent: public ServicedComponent { public: void TransactionalMethod( String^ data ) { ContextUtil::DeactivateOnReturn = true; ContextUtil::MyTransactionVote = TransactionVote::Abort; // do work with data ContextUtil::MyTransactionVote = TransactionVote::Commit; } };
Available since 1.1