Application Activation Type

To specify the COM+ application’s activation type, you can use the ApplicationActivation assembly attributes. You can request that the application be a library or a server application:

[assembly: ApplicationActivation(ActivationOption.Server)]

or:

[assembly: ApplicationActivation(ActivationOption.Library)]

If you do not provide the ApplicationActivation attribute, then .NET uses a library activation type by default. Note that this use differs from the COM+ default of creating a new application as a server application.

Tip

The next release of Windows 2000, Windows XP (see Appendix B), allows a COM+ application to be activated as a system service, so I expect that ApplicationActivation will be extended to include the value of ActivationOption.Service.

Before I describe other serviced components attributes, you need to understand what attributes are. Every .NET attribute is actually a class, and the attribute class has a constructor (maybe even a few overloaded constructors) and, usually, a few properties you can set. The syntax for declaring an attribute is different from that of any other class. In C#, you specify the attribute type between square brackets [...]. You specify constructor parameters and the values of the properties you wish to set between parentheses (...).

In the case of the ApplicationActivation attribute, there are no properties and the constructor must accept an enum parameter of type ActivationOption , defined as:

enum ActivationOption{Server,Library} ...

Get COM & .NET Component Services now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.