IObjectContext interface
Provides access to the current object's context. An object's context is primarily used when working with transactions or dealing with the security of an object.
When to implement
COM+ implements this interface.
When to use
To obtain a reference to the IObjectContext interface, call the GetObjectContext function, or call the CoGetObjectContext function and specify IID_IObjectContext as the riid parameter.
You can use an object's IObjectContext to do the following:
-
Declare that the object's work is complete.
-
Prevent a transaction from being committed, either temporarily or permanently.
-
Instantiate other COM+ objects and include their work within the scope of the current object's transaction.
-
Determine whether a caller is in a particular role.
-
Determine whether security is enabled.
-
Determine whether the object is executing within a transaction.
Members
The IObjectContext interface inherits from the IUnknown interface. IObjectContext also has these types of members:
Methods
The IObjectContext interface has these methods.
| Method | Description |
|---|---|
| CreateInstance |
Creates an object using current object's context. |
| DisableCommit |
Declares that the object's transactional updates are in an inconsistent state and cannot be committed in their present state. |
| EnableCommit |
Declares that the object's work is not necessarily finished but that its transactional updates are in a consistent state and could be committed in their present form. |
| IsCallerInRole |
Indicates whether the object's direct caller is in a specified role (either directly or as part of a group). |
| IsInTransaction |
Indicates whether the object is executing within a transaction. |
| IsSecurityEnabled |
Indicates whether security is enabled for the current object. COM+ security is enabled unless the object is running in the client's process. |
| SetAbort |
Declares that the transaction in which the object is executing must be aborted and that the object should be deactivated when it returns from the currently executing method call. |
| SetComplete |
Declares that the transaction in which the object is executing can be committed and that the object should be deactivated when it returns from the currently executing method call. |
Remarks
As with any COM object, you must release an IObjectContext object when you are finished using it, unless it is a local variable.
Requirements
|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server | Windows 2000 Server [desktop apps only] |
|
Header |
|
See also