O'Reilly logo

COM & .NET Component Services by Juval Lowy

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 1. COM+ Component Services

By now, most developers of large-scale enterprise applications are convinced of the benefits of component-oriented development. They have discovered that by breaking a large system down into smaller units, they can write code that is easier to reuse on other projects, easier to distribute across multiple computers, and easier to maintain. As long as these components adhere to a binary standard that defines how they communicate with one another, they can be invoked as needed at runtime and discarded when they have finished their work. This type of application is also particularly suited to the Web, where clients request services of remote applications and then, once satisfied, move on to other tasks.

For nearly a decade, the Microsoft Component Object Model (COM) has been the standard for components that run on Windows machines, including Windows 9x and Me clients and Windows NT and 2000 servers. The COM model is well documented by the Microsoft Component Object Model Specification. Tools such as Visual C++ and Visual Basic make it easy to create COM components, and scores of books, training classes, and articles are available to teach programmers how to use them. Many features of the Windows operating system are now implemented as COM components, and many companies have invested heavily in COM-based systems of their own.

In July 2000, Microsoft announced a radically new component model as part of its .NET development platform, suddenly calling into question the viability of existing COM applications. .NET components bear little resemblance to legacy COM components and are not backwards compatible. They can be made to interoperate with COM components but do not do so naturally.

When it comes to the services and tools programmers use to build enterprise-scale .NET applications, however, one facility continues to provide the necessary runtime infrastructure and services: COM+ component services. These services have been available on Windows 2000 since its release, but they will gain greater importance in the months ahead. As it turns out, they offer a bridge between traditional COM and .NET applications, making your understanding and mastery of them as important now as it has ever been.

In this chapter, we provide a quick overview of the COM+ suite of component services and then introduce you to the Component Services Explorer, your primary tool for building and managing both COM and .NET enterprise applications. You will also create, debug, and deploy a simple COM+ “Hello World” application, using a traditional COM component and learning about COM+ application types and configured components as you do so.

COM+ Component Services

Components need runtime services to work. The original COM runtime supported components located on the same machine, typically a desktop PC. As the focus of Windows development shifted from standalone PCs to networked systems, Microsoft found it necessary to add additional services (see The Evolution of COM+ Services). First, they added support for distributed applications, or applications whose components are located on more than one machine (sometimes referred to as “COM on a wire”). Later, Microsoft added new services to support enterprise applications, whose complexity and scale placed new demands on the resources of a system and required an entirely new level of support. These trends were only exacerbated by the move to web-based applications aimed at huge numbers of customers connected over the public Internet.

Collectively, the services that support COM and .NET component-based applications are known as the COM+ component services, or simply as COM+.

Here is a quick summary of the most important services provided by COM+:

Administration

Tools and services that enable programmers and administrators to configure and manage components and component-based applications. The most important tool is the Microsoft Management Console Component Services Explorer. COM+ also provides a standard location, the COM+ Catalog, for storing configuration information. The Component Services Explorer is explained in the following section. The COM+ Catalog is described in Chapter 6.

Just-in-Time Activation (JITA)

Services that instantiate components when they are called and discard them when their work is done. JITA is explained in Chapter 3.

Object pooling

Services that allow instances of frequently used, but expensive, resources, such as database connections, to be maintained in a pool for use by numerous clients. Object pooling can improve the performance and responsiveness of a distributed application dramatically. It is explained in Chapter 3.

Transactions

Services that allow operations carried out by distributed components and resources such as databases to be treated as a single operation. Transaction management is a requirement of most commercial systems. COM+ Transaction services are discussed in Chapter 4.

Synchronization

Services for controlling concurrent access to objects. These services are explained in Chapter 5.

Security

Services for authenticating clients and controlling access to an application. COM+ supports role-based security, which is explained in Chapter 7.

Queued components

Services that allow components to communicate through asynchronous messaging, a feature that makes possible loosely coupled applications or even disconnected applications. Queued components are discussed in Chapter 8.

Events

Services that allow components to inform one another of significant events, such as changes in data or system state. COM+ supports a publish-subscribe model of event notification, which is described in Chapter 9.

To summarize, COM+ is about component services and has almost nothing to do with the way a component is developed. The .NET framework allows you to develop binary components more easily than does COM, but it continues to rely on component services available through COM+. The manner in which .NET and COM components are configured to use these services, however, is not the same. Currently, most Windows enterprise developers are developing applications based on the existing COM standard using Visual Basic 6 and Visual C++ 6 with ATL. For this reason, this book uses COM examples to demonstrate COM+. However, these same services are available to .NET components as well. Chapter 10 shows you how to use them.

COM+ 1.0 is an integral part of Windows 2000 and requires no special installation. Some COM+ features are available only when both the client and server are running on Windows 2000 machines, but COM+ clients can usually run on Windows 9.x and Windows NT machines as well.

When Windows XP is released in Q4 2001, it will include a new version of COM+ component services, COM+ 1.5. This new version improves COM+ 1.0 usability and addresses some of the pitfalls of using COM+ 1.0 on Windows 2000, as described in this book. COM+ 1.5 also adds new features to existing services and lays the foundation for integration with .NET web services. Appendix B summarizes the forthcoming changes.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required