Aliasing Components

Under COM+ 1.0 you cannot use the same component with more than one set of configurations—like in classic COM, a component is associated with just one CLSID. COM+ 1.5 allows you to alias an existing configured component with a new CLSID and apply a new set of configurations to the “new” component. This process is called aliasing a component. Aliasing is often a useful feature—you can develop a piece of business logic and assign more than one set of configuration parameters to it by copying it as many times as you like. The component’s client can now decide which configuration setting and business logic implementation to instantiate by creating a particular CLSID. To alias a component, select Alias from its pop-up context menu in the Component Services Explorer. This selection brings up the Alias Component dialog box (see Figure B-12)

Aliasing a component

Figure B-12. Aliasing a component

The dialog box lets you select a destination application for the new component. Because you are assigning a new CLSID to the component, you can even copy it back to its current application. The dialog generates the new CLSID for the copy and a new prog-ID (< CopyOf >.< Old prog-ID >, see Figure B-12). You can provide your own values for the CLSID and prog-ID, if you like. Initially, the new component has configuration settings that are identical to the original component. Once you copy a component, the original and the clone are considered different components from the COM+ point of view. You can configure them differently, even though the configurations apply to the same actual component at runtime.

Copying components is also handy in the case of event classes. As you may recall from Chapter 9, you must supply COM+ with a skeletal implementation of an event class (stub out all implementation of the sinks) so that COM+ can synthesize its own implementation of the event class. You may often provide more than one event class so that some subscribers can subscribe to one event class and some to another. With component copying, you only need to provide one, and then just copy it.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset