ContextUtil::DeactivateOnReturn Property
.NET Framework (current version)
Gets or sets the done bit in the COM+ context.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
public: property bool DeactivateOnReturn { static bool get(); static void set(bool value); }
Property Value
Type: System::Booleantrue if the object is to be deactivated when the method returns; otherwise, false. The default is false.
| Exception | Condition |
|---|---|
| COMException | There is no COM+ context available. |
| PlatformNotSupportedException | The platform is not Windows 2000 or later. |
The COM+ done bit determines how long the object remains active after finishing its work and can affect the duration of a transaction. When a method call returns, COM+ inspects the done bit. If the done bit is true, COM+ deactivates the object. If the done bit is false, the object is not deactivated.
The following code example demonstrates the use of the DeactivateOnReturn property to ensure that a ServicedComponent is deactivated after a method call.
[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; } };
.NET Framework
Available since 1.1
Available since 1.1
Show: