An Overview of the COM Catalog

team lib

An Overview of the COM+ Catalog

If you've worked at least a little with COM+ using unmanaged components, you know that the information for these components is stored in the COM+ catalog. Using the publish/subscribe method of event handling requires you to know a little more than just this basic piece of information. The COM+ catalog is a special-purpose database that Microsoft Windows uses to store information about the COM+ applications you create. The developer can change every element of that database using standard interfaces and search techniques, as we'll see when working with both the transient and permanent subscription code in this chapter.

As a .NET developer, you must import the COM+ 1.0 Admin Type Library into your component or application to work with the COM+ catalog. The library reference will appear as COMAdmin in the References folder. This type library contains a vast number of interfaces and classes, as shown in Figure 10-1. We'll work with only a few of the many classes and interfaces in this book, but it pays to know that the other classes and interfaces exist should you need them for another product. This library encapsulates many of the features that we'll call Component Services throughout this chapter and the remaining COM+ sections of the book.

click to expand
Figure 10-1: The COM+ 1.0 Admin Type Library contains a vast number of classes and interfaces used for COM+ development.

It often helps to look at Component Services when you need to envision what you'll do next with the COM+ catalog. For example, if you need to find information about a specific component, you'll need to find the associated application first, and then locate the component. You'll always use an ICatalogCollection object-such as a component or an interface-to access a node within the COM+ catalog. Once you find the object you want to work with, you'll use an ICatalogObject object to access individual properties. These two interfaces and a few methods within them are all you'll need to find any piece of information within the COM+ catalog.

Every property can be accessed within the COM+ catalog using the Value() method of the ICatalogObject interface. You'll access the properties by providing an index value in the form of a keyword. Unfortunately, the development environment won't list these keywords for you, so it takes some research at times to find precisely what you need. The examples in the transient and permanent subscription code sections of the chapter will provide you with keywords for many uses.

There's also the idea of a collection within the COM+ catalog. COM+ collections are the predecessors of the collections commonly used within the .NET Framework, but the two environments have differences you need to know about. When you create an object, you have the equivalent of an empty vessel. Before you can do anything with the object, you need to fill it up. COM+ uses a special method, named Populate() for this purpose. As soon as you've identified a unique resource within the COM+ Catalog, you can use the Populate() method to retrieve the entire collection of those types of objects.

The Populate() method creates a local copy of the object information that you need for working with the COM+ catalog. Any changes you make are on the local copy, and the changes won't affect what anyone else is seeing when making requests of the COM+ catalog until you save the local copy to the global catalog. In addition, the COM+ catalog validates all changes. The COM+ catalog will deny any changes that don't fit within the validation specifications. You'll always use the SaveChanges() method of the ICatalogCollection interface to make any changes permanent. Make sure you save changes before you move to another area of the COM+ catalog or they'll be lost in many cases.

This is the short overview of the COM+ catalog. You'll learn more about this important COM+ feature as the chapter progresses. For now, you have just enough information to understand the remaining material in the chapter.

 
team lib


COM Programming with Microsoft .NET
COM Programming with Microsoft .NET
ISBN: 0735618755
EAN: 2147483647
Year: 2006
Pages: 140

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net