Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Automate Component Registration Using MTXAdmin

Leverage Microsoft Transaction Server's component model to register your components without breaking a sweat or leaving the IDE.


advertisement
As developers, we are trained to look at workflows, trends and needs, perform an analysis of our own personal experience, and recognize repetitive actions that could benefit from automation. So it is surprising that when you ask a developer "How much time have you spent writing applications that automate your own job?" the answer is usually "None." All too often we are so busy making our users' lives easier that we fail to recognize opportunities to enhance our own productivity.

One of the most common enterprise VB development tasks is registering COM objects to a development server. Registering objects, although not difficult, can certainly become monotonous. Many developers spend more of their day than they would care to admit in the Windows and MTS Explorers, dragging files from here to there, right-clicking this and that, just to register a component. Fortunately, Microsoft has provided us with the ability to access most of the MTS Explorer's functionality via the MTXAdmin type library. This article explores a few of MTXAdmin's features and demonstrates how to embed some of them into a COM component of your own. You'll also see how to write a VB add-in that will allow you to register your components without ever leaving the Visual BASIC IDE.

 
Figure 1: The MTS Explorer.



MTXAdmin Basics
MTXAdmin's object hierarchy is tied very closely to the structure shown in the MTS Explorer (see Figure 1). Start with a top-level object, MTSAdmin.Catalog, which exposes a collection of packages. Each package object has a collection containing zero or more component objects. Note that the component object also abstracts other objects such as roles and users. However, since the focus of this article is on removing and registering components, it covers only the Packages collection.

Connecting to the server and getting a list of packages requires only four lines of code:

'Create the catalog object and connect Set oCatalog = CreateObject("MTSAdmin.Catalog.1") oCatalog.Connect "" 'Create and populate the packages collection Set oPackages = oCatalog.GetCollection("Packages") oPackages.Populate



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap