COM+ Context Attributes
You can decorate
(apply attributes to) your class with two context-related attributes.
The attribute
MustRunInClientContext
informs COM+ that the class must be
activated in its creator’s context:
[MustRunInClientContext(true)]
public class MyComponent :ServicedComponent
{...}When you register the class above with COM+, the “Must be
activated in caller’s context” checkbox on the
component’s Activation tab is selected in the Component
Services Explorer. If you do not use this attribute, the registration
process uses the default COM+ setting when registering the component
with COM+ —not enforcing same-context activation. As a result,
using MustRunInClientContext with a
false parameter passed to the constructor is the
same as using the COM+ default:
[MustRunInClientContext(false)]
Using attributes with the COM+ default values (such as constructing
the MustRunInClientContext attribute with
false) is useful when you combine it with the
/reconfig switch of RegSvcs. For example, you can
undo any unknown changes made to your component configuration using
the Component Services Explorer and restore the component
configuration to a known state.
The MustRunInClientContext attribute class has an
overloaded default constructor. If you use
MustRunInClientContext with no parameters, the
default constructor uses true
for the attribute value. As a result, the following two
statements are equivalent:
[MustRunInClientContext] [MustRunInClientContext(true)]
The second COM+ context-related ...
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