ContextUtil Class
Obtains information about the COM+ object context. This class cannot be inherited.
Assembly: System.EnterpriseServices (in System.EnterpriseServices.dll)
| Name | Description | |
|---|---|---|
![]() ![]() | ActivityId | Gets a GUID representing the activity containing the component. |
![]() ![]() | ApplicationId | Gets a GUID for the current application. |
![]() ![]() | ApplicationInstanceId | Gets a GUID for the current application instance. |
![]() ![]() | ContextId | Gets a GUID for the current context. |
![]() ![]() | DeactivateOnReturn | Gets or sets the done bit in the COM+ context. |
![]() ![]() | IsInTransaction | Gets a value that indicates whether the current context is transactional. |
![]() ![]() | IsSecurityEnabled | Gets a value that indicates whether role-based security is active in the current context. |
![]() ![]() | MyTransactionVote | Gets or sets the consistent bit in the COM+ context. |
![]() ![]() | PartitionId | Gets a GUID for the current partition. |
![]() ![]() | SystemTransaction | Gets the current transaction context. |
![]() ![]() | Transaction | Gets an object describing the current COM+ DTC transaction. |
![]() ![]() | TransactionId | Gets the GUID of the current COM+ DTC transaction. |
| Name | Description | |
|---|---|---|
![]() ![]() | DisableCommit() | Sets both the consistent bit and the done bit to false in the COM+ context. |
![]() ![]() | EnableCommit() | Sets the consistent bit to true and the done bit to false in the COM+ context. |
![]() | Equals(Object^) | Determines whether the specified object is equal to the current object.(Inherited from Object.) |
![]() | GetHashCode() | Serves as the default hash function. (Inherited from Object.) |
![]() ![]() | GetNamedProperty(String^) | Returns a named property from the COM+ context. |
![]() | GetType() | |
![]() ![]() | IsCallerInRole(String^) | Determines whether the caller is in the specified role. |
![]() ![]() | IsDefaultContext() | Determines whether the serviced component is activated in the default context. Serviced components that do not have COM+ catalog information are activated in the default context. |
![]() ![]() | SetAbort() | Sets the consistent bit to false and the done bit to true in the COM+ context. |
![]() ![]() | SetComplete() | Sets the consistent bit and the done bit to true in the COM+ context. |
![]() ![]() | SetNamedProperty(String^, Object^) | Sets the named property for the COM+ context. |
![]() | ToString() | Returns a string that represents the current object.(Inherited from Object.) |
ContextUtil is the preferred class to use for obtaining COM+ context information. Because the members of this class are all static (shared in Visual Basic), it is not necessary to instantiate it before using them.
The following code example demonstrates how to use ContextUtil 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
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


