Share via


Applying Attributes to Configure COM+ Services

This topic provides the default value of each design-time attribute in the System.EnterpriseServices namespace. by knowing the default value of each attribute, you can eliminate unnecessary attributes in your code. If you are not familiar with the role of attributes on metadata, see Extending Metadata Using Attributes.

The following is the default usage information for each service-related attribute:

  • Attribute scope. Identifies whether the attribute applies to only a method, class, or to an entire assembly.

  • Unconfigured default value. Displays the value that COM+ assigns to the field when the attribute is omitted from code. For example, if you omit the JustInTimeActivationAttribute attribute from a class, COM+ sets the default value to False.

  • Configured default value. Displays the value that COM+ assigns to a field when you apply an attribute but omit the attribute value. The following example shows how to set the JustInTimeActivationAttribute attribute to True on a class:

    Imports System.EnterpriseServices
    <JustInTimeActivation()> Public Class Account 
    Inherits ServicedComponent
       Shared Sub Main()
       End Sub
    End Class 
    [C#]
    using System.EnterpriseServices;
    [JustInTimeActivation]
    public class Account : ServicedComponent
    {
       static void Main() 
    {}
    }
    

    Makefile.bat

    You can compile the example as follows:

    vbc /t:exe /r:System.EnterpriseServices.dll Demo.vb
    [C#]
    csc /t:exe /r:System.EnterpriseServices.dll Demo.cs
    

Service-Related Attributes

The following table lists the scope and default values, configured and unconfigured, for service-related attributes.

Attribute Attribute scope Unconfigured default value Configured default value
ApplicationAccessControlAttribute Assembly True True
ApplicationActivationAttribute Assembly Library No default
ApplicationIDAttribute Assembly Generated GUID No default
ApplicationNameAttribute Assembly Assembly name No default
ApplicationQueuingAttribute Assembly No default No default
AutoCompleteAttribute Method False True
ComponentAccessControlAttribute Class False True
COMTIIntrinsicsAttribute Class False True
ConstructionEnabledAttribute Class False True
DescriptionAttribute Assembly

Class

Method

Interface

No default No default
EventClassAttribute Class No default FireInParallel = False

AllowInprocSubsribers = True

PublisherFilter = Null

EventTrackingEnabledAttribute Class False True
ExceptionClassAttribute Class No default No Default
IISIntrinsicsAttribute Class False True
InterfaceQueuingAttribute Class

Interface

False True
JustInTimeActivationAttribute Class False True
LoadBalancingSupportedAttribute Class False True
MustRunInClientContextAttribute Class False True
ObjectPoolingAttribute Class False True
PrivateComponentAttribute Class No default Private
SecureMethodAttribute Assembly

Class

Method

No default No default
SecurityRoleAttribute Assembly

Class

Interface

No default No default
SynchronizationAttribute Class False SynchronizationOption.Required
TransactionAttribute Class False TransactionOption.Required

TransactionIsolationLevel.Serializable

Timeout = infinite

See Also

Writing Serviced Components | System.EnterpriseServices | Serviced Component Overview | Registering Serviced Components | Serviced Component Example | Summary of Available COM+ Services | Extending Metadata Using Attributes | System.EnterpriseServices Namespace