and you could quite rightly think that there is little point in ever overriding them, as there isn’t much to
add to the base implementation. As mentioned, these are your verification methods, and code has been
added for verification that the operation about to take place within the base class is allowed. The following
sections expand on the types of checks you can do, and if you want to build a robust component, these
are well worth looking into.
Another very good reason to implement these methods as described is actually to reduce code. These
methods will be used by both a custom user interface (UI) and the built-in component editor, or Advanced
Editor. If you raise an error saying that a change is not allowed, then both user interfaces can capture this
and provide feedback to the user. Although a custom UI would not be expected to offer controls to perform
blatantly inappropriate actions, the Advanced Editor is designed to offer all functionality, so you are
protecting the integrity of your component regardless of the method used.
ProvideComponentProperties
This method is provided so you can set up your component. It is called when a component is first added
to the Data Flow, and it initializes the component. It does not perform any column-level activity, as this
is left to
ReinitializeMetadata; when this method is invoked, there are generally no inputs to out-
puts to be manipulated anyway. The sorts of procedures you may want to set in here are listed below.
❑ Remove existing settings, such as inputs and outputs. This allows the component to be rebuilt
and can be useful when things go wrong.
❑ Add inputs and outputs, ready for column work later on in the component lifetime. You may
also define custom properties on them and specify related properties, such as linking them
together for synchronous behavior.
❑ Define the connection requirements. By adding an item to the RuntimeConnectionCollection,
you have a placeholder prepared for the Connection Manager at runtime, as well as informing
the designer of this requirement.
❑ The component may have custom properties that are configurable by a user in addition to those
you get for free from Microsoft. These will hold settings other than the column-related one that
effect the overall component operation or behavior.
Validate
Validate is called numerous times during the lifetime of the component, both at design-time and at
runtime, but the most interesting work is usually the result of a design-time call. As the name suggests,
it validates that the content of the component is correct and will enable you to at least run the package. If
the validation encounters a problem, then the return code used is important to determine any further
actions, such as calling
ReinitializeMetadata. The base class version of Validate performs its own
checks in the component, and you will need to extend it further in order to cover your specific needs.
Validate should not be used to change the component at all; it should only report the problems it finds.
ReinitializeMetaData
The ReinitializeMetaData method is where all the building work for your component is done. You
add new columns, remove invalid columns, and generally build up the columns. It is called when the
Validate method returns VS_NEEDSNEWMETADATA. It is also your opportunity in the component to do
any repairs that need to be done, particularly around invalid columns as mentioned previously.
420
Chapter 14
17 584359 ch14.qxd 12/16/05 6:31 PM Page 420