The Context Object
COM+ represents each context by an object called the
context object.
Every context has exactly one context
object. Objects can obtain a pointer to their context object by
calling CoGetObjectContext( )
(see Figure 2-5). All objects in the same context
get the same context object.
CoGetObjectContext( ) is defined as:

Figure 2-5. By calling CoGetObjectContext( ), objects can get a pointer to their context’s context object
HRESULT CoGetObjectContext(REFIID riid, void** ppInterface);
The context object supports a few interfaces, so the first parameter
of CoGetObjectContext( ) is always an IID that
specifies which interface to retrieve. Two of the context
object’s interfaces, IObjectContext and
IObjectContextActivity, are legacy interfaces from
MTS and are provided primarily for backward compatibility with MTS
components running under COM+. The other two interfaces,
IContextState
and
IObjectContextInfo
, are specific to COM+. Throughout
this book, all chapters use these two interfaces, rather than the
legacy MTS interfaces.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access