Programming the COM+ Catalog
You
can access the COM+ Catalog from
within any .NET managed component (not only serviced components). To
write installation or configuration code (or manage COM+ events), you
need to add to your project a reference to the
COM+
Admin type library. After you add the reference, the Catalog
interfaces and objects are part of the
COMAdmin
namespace. Example 10-10 shows how to create a catalog object and use
it to iterate over the application collection, tracing to the Output
window the names of all COM+ applications on your computer.
Example 10-10. Accessing the COM+ Catalog and tracing the COM+ application names
using COMAdmin;
ICOMAdminCatalog catalog;
ICatalogCollection applicationCollection;
ICatalogObject application;
int applicationCount;
int i;//Application index
catalog = (ICOMAdminCatalog)new COMAdminCatalog( );
applicationCollection = (ICatalogCollection)catalog.GetCollection("Applications");
//Read the information from the catalog
applicationCollection.Populate( );
applicationCount = applicationCollection.Count;
for(i = 0;i< applicationCount;i++)
{
//Get the current application
application= (ICatalogObject)applicationCollection.get_Item(i);
int index = i+1;
String traceMessage = index.ToString()+". "+application.Name.ToString( );
Trace.WriteLine(traceMessage);
}Tip
The
System.EnterpriseServices.Admin
namespace contains the COM+ Catalog object and interface definitions. However, in the Visual Studio.NET Beta 2, the interfaces are defined as private ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access