Home > Articles > Programming > Windows Programming

  • Print
  • + Share This
From the author of

#3 Component Aliasing

Windows .NET Server also adds an interesting feature called component aliasing. Basically, this feature allows a single implementation of a component to be referenced by more than one Prog ID in the same or a different application. At first glance, this feature may seem strange, but consider the case in which you've written a data access component that will used by different applications that each access a different database (albeit one with the same structure, perhaps). In this case, rather than reimplement the component in a different application, you can simply alias the component into the new application and give it a new Prog ID. This allows you to enable construction for the component on the Activation tab, thereby passing in a unique connection string when the component is instantiated.

To enable aliasing, you simply choose the Alias menu item from the component's context menu. A dialog box (shown in Figure 3) will be invoked, allowing you to specify in which application the aliased component will sit, and the new Prog ID and class ID (CLSID) that will be placed in the registry.

Figure 3 This dialog box is invoked when Alias is chosen for a component. It allows you to specify where the component will exist and how it will be called.

  • + Share This
  • 🔖 Save To Your Account