|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.|
Serviced Component Overview
A serviced component is a class that is authored in a CLS-compliant language and that derives directly or indirectly from the System.EnterpriseServices.ServicedComponent class. Classes configured in this way can be hosted in a COM+ application and can use COM+ services by way of the EnterpriseServices namespace. For a list of supported services, see Summary of Available COM+ Services.
COM+ services, such as automatic transactions or Queued Components, can be configured declaratively. You apply service-related attributes at design time and create instances of classes that use those services. You configure some services by calling methods on service-related classes or interfaces. Some services can flow from one object to another. For example, an object configured to require a transaction can extend that transaction to a second object if the second object also supports or requires transactions.
The COM+ catalog holds the configuration information that you apply to a class implementation. At run time, based on the attributes you apply to your code, COM+ creates a context service layer. The following illustration shows an automatic transaction that flows between two managed objects hosted by COM+.
Services can also flow between COM+ and .NET Framework objects. Each environment controls the implementation and execution of its native code; COM+ always provides the object context.
Client code must call Dispose on serviced components to ensure proper operation.