Implementing the IPipelineComponent Interface

All pipeline components must implement the IPipelineComponent interface to function within the Pipeline Editor. If you have created your pipeline component using the Visual Basic Pipeline Component Wizard, your component supports this interface.

In a Microsoft ActiveX dynamic-link library (DLL), the pipeline component is a class in the DLL that implements one or more of the pipeline component interfaces. You add a reference to the type library defining the interfaces, add the appropriate implementation statements, and write the implementation code. This is done for you if you used the Visual Basic Pipeline Component Wizard.

For detailed instructions about implementing COM interfaces in Visual Basic, see "Creating and Implementing an Interface" and "Implementing and Using Standard Interfaces" in Visual Basic Help.

All pipeline component interfaces are described in a type library named Pipecomplib.tlb. If you look at the code created by the Visual Basic Pipeline Component Wizard in Running the Visual Basic Pipeline Component Wizard, you will see that the project includes a reference to this library.

The code for the class begins with the following lines:

Implements IPersistDictionary
Implements IPipelineComponent
Implements ISpecifyPipelineComponentUI
Implements IPipelineComponentDescription
Implements IPipelineComponentAdmin

This component implements four interfaces in addition to the IPipelineComponent interface. For more information about the other interfaces implemented by the Visual Basic Pipeline Component Wizard, see Pipeline Component Interfaces.

Further down in the code, you can see the code implementing the two methods of the IPipelineComponent interface, the EnableDesign method, and the Execute method.

The code for the EnableDesign method is:

Private Sub IPipelineComponent_EnableDesign(ByVal fEnable As Long)
End Sub

The EnableDesign method is used by the Pipeline Editor to tell the component when it is being used in design mode and when it is being executed. No changes need to be made to this code.

The Execute method contains most of the functionality of the component. It determines whether or not there was an error, and if the pipeline can continue to execute. The following outline of the Execute method is straightforward:

' Execute() -- This function gets called when the pipeline runs.
' Return 1 for success, 2 for user warnings, 3 for error.
Private Function IPipelineComponent_Execute(ByVal objOrderForm As Object, ByVal objContext As Object, ByVal 1Flags As Long) As Long

      ' Initialization of variables

      IPipelineComponent_Execute = 1

      ' The implementation of the component appears here.

End Function

Ee823616.note(en-US,CS.20).gif Note

  • Although it might appear that the dictionaries are passed by value, that is not the case. What is passed by value is a reference to the dictionary — its address (not the contents of the dictionary). A reference passed by value is basically the same as the object passed by reference.

The Execute method is a function that returns a Long. It returns one of three values: 1 for success, 2 for user warnings, and 3 for an error that should stop execution of the pipeline.

For detailed instructions about implementing COM interfaces in Visual Basic, see "Creating and Implementing an Interface" and "Implementing and Using Standard Interfaces" in Visual Basic Help.

Using Commerce Server Objects

Pipeline components written in Visual Basic can use Commerce Server objects. The project for a component created using the Visual Basic Pipeline Component Wizard includes a reference to the Microsoft Commerce 2000 Core Components Type Library and creates variables of the CDictionary type and assigns the dictionaries passed to the Execute method to the variables:

 ' Initialize the PipeCtx dictionary as
 ' CDictionary variables
    Dim objPipeCtx As CDictionary
    Set objPipeCtx = objContext

Ee823616.note(en-US,CS.20).gif Note

  • The dictionary has a type library name of CDictionary and a ProgID of Commerce.Dictionary.

For example, if your component includes a reference to the Microsoft Commerce 2000 Core Components Type Library, you can take advantage of early binding, and strongly type your variables in the declaration of the variables:

Dim dictLocalDictionary As Cdictionary
Set dictLocalDictionary = New CDictionary
dictLocalDictionary("Nickel") = ("what is nickel")

See Programmer's Reference for a complete list of objects in Commerce Server and for details about their use.

See Also

Pipeline Component Interfaces

Using the Visual Basic Pipeline Component Wizard

Persisting Data

Using the Pipeline Component Registration Tool

Special Considerations for Visual Basic Pipeline Components

Copyright © 2005 Microsoft Corporation.
All rights reserved.