Persisting Data
Visual Basic pipeline components can use the IPersistDictionary interface to implement persistence. The Pipeline Editor and pipelines themselves support this interface for loading and saving. The IPersistDictionary interface is used to persist data for a pipeline component. The Pipeline Editor uses the IPersistDictionary interface to get configuration values from the component and save them in the pipeline configuration file through the Save method.
Similarly, the pipeline passes a dictionary loaded with the previously saved values to the component. Because the Pipeline Editor handles the storage of the data, the component needs only to manipulate a dictionary.
The following table describes the methods of the IPersistDictionary interface.
Method | Description |
GetProgID | Returns the ProgID of the component. |
IsDirty | Returns a Boolean value of True if the values have changed since they were last saved. |
InitNew | Called to initialize the object. |
Load | Loads the Dictionary object with the saved values. |
Save | Saves the values in the Dictionary object. |
The InitNew method initializes the default values for a new instance of the object. In the code created by the Visual Basic Pipeline Component Wizard in Running the Visual Basic Pipeline Component Wizard, the method is called by the Pipeline Editor:
Private Sub IPersistDictionary_InitNew()
FIsDirty = False
End Sub
The IsDirty method checks whether the values of an object have changed since they were last saved. It returns the value of the IsDirty flag of the object. The flag is cleared by the object in its implementation of the IPersistDictionary::Save method.
The GetProgID method must return the ProgID of the object. In the example, this is a constant that matches the ProgID under which the object is registered. By default, in an ActiveX DLL this is the project name followed by a period and the class name. For example:
Private Function IPersistDictionary_GetProgID() As String
IPersistDictionary_GetProgID = "MyProject.ClassName"
End Function
Private Function IPersistDictionary_IsDirty() As Long
IPersistDictionary_IsDirty = fIsDirty
End Function
The IPersistDictionary interface provides a convenient way for pipeline components housed in ActiveX DLLs to save configuration values. If a component is implemented as an ActiveX Control, the component can use the control property bag to save the configuration values.
Note
- Although you can create your pipeline component as a Visual Basic ActiveX control and use the property page of the control as the configuration tab in the Pipeline Editor, this is not recommended.
See Also
Using the Visual Basic Pipeline Component Wizard
Implementing the IPipelineComponent Interface
Using the Pipeline Component Registration Tool