Export (0) Print
Expand All

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.

AttributeAttribute scopeUnconfigured default valueConfigured default value
ApplicationAccessControlAttributeAssemblyTrueTrue
ApplicationActivationAttributeAssemblyLibraryNo default
ApplicationIDAttributeAssemblyGenerated GUIDNo default
ApplicationNameAttributeAssemblyAssembly nameNo default
ApplicationQueuingAttributeAssemblyNo defaultNo default
AutoCompleteAttributeMethodFalseTrue
ComponentAccessControlAttributeClassFalseTrue
COMTIIntrinsicsAttributeClassFalseTrue
ConstructionEnabledAttributeClassFalseTrue
DescriptionAttributeAssembly

Class

Method

Interface

No defaultNo default
EventClassAttributeClassNo defaultFireInParallel = False

AllowInprocSubsribers = True

PublisherFilter = Null

EventTrackingEnabledAttributeClassFalseTrue
ExceptionClassAttributeClassNo defaultNo Default
IISIntrinsicsAttributeClassFalseTrue
InterfaceQueuingAttributeClass

Interface

FalseTrue
JustInTimeActivationAttributeClassFalseTrue
LoadBalancingSupportedAttributeClassFalseTrue
MustRunInClientContextAttributeClassFalseTrue
ObjectPoolingAttributeClassFalseTrue
PrivateComponentAttributeClassNo defaultPrivate
SecureMethodAttributeAssembly

Class

Method

No defaultNo default
SecurityRoleAttributeAssembly

Class

Interface

No defaultNo default
SynchronizationAttributeClassFalseSynchronizationOption.Required
TransactionAttributeClassFalseTransactionOption.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

Show:
© 2014 Microsoft