The Design Time Methods


The design time interface is for establishing and managing the component's metadata. The sample components are derived from the base class Microsoft.SqlServer.Dts.PipelineComponent in the Microsoft.SqlServer.PipelineHost assembly and provide the default behavior for most of the methods while hiding much of the complexity involved in writing native code custom components. Although the base class supports many methods, fortunately it also handles the implementation of most of the methods. You only need override a few of the important methods, as discussed in the following sections.

ProvideComponentProperties

This is the method you use to set up your component and is called the first time you drop the component onto the design surface. Typically, the kinds of things you do in this method are as follows:

  • Add inputs and outputs

  • Define connection requirements

  • Define custom properties such as BatchSize or Timeout

ReinitializeMetaData

You use this method to provide the column-level information for the component. It is called when the Validate method returns VS_NEEDSNEWMETADATA or when the user clicks the Refresh button in the Advanced UI. When initially called, this method adds all the columns and column information. Upon subsequent calls, this method is where column metadata can be fixed if corrupted.

Validate

You use this method to verify the correctness of the column metadata and other component settings such as connection availability. It is called repeatedly during package design, and once right before the PrimeOutput/ProcessInput calls. You should never modify the column or other component metadata during this call. During validation, you should verify the following:

  • Component custom properties exist and are valid values.

  • A runtime connection is specified and a connection manager exists.

  • The connection manager is of the correct type.

  • The component has the correct number of inputs.

  • The component has the correct number of outputs.

If validation succeeds, the component should return DTSValidationStatus.VS_ISVALID. If validation fails, the component should raise appropriate errors and warnings to alert the user to the problems and then return one of the following DTSValidationStatus values.

  • VS_ISBROKEN Indicates that the component is not configured correctly but could be fixed by the user.

  • VS_NEEDSNEWMETADATA Indicates that the validation errors could be fixed by a call to ReinitializeMetaData.

  • VS_ISCORRUPT Indicates that the ComponentMetaData is corrupt and cannot be repaired by a call to the ReinitializeMetaData method or by edits to the component.

Note

If the DelayValidation property of the Data Flow Task is set to TRUE, the designer will not call Validate on the component. Validate is only called during package execution.


AcquireConnections and ReleaseConnections

These methods are called for every major component operation and establish and release connections. If the component uses connection managers, these methods must be implemented. If not, they are not needed and can be ignored.

RegisterEvents

If your component fires any custom events, you should register them with this method. It performs the same function as the EventInfos do for custom tasks. In fact, when you register events using the RegisterEvents method, the Data Flow Task creates a corresponding EventInfos entry for the event at the task level.

RegisterLogEntries

If your component logs custom log entries, you should register them with this method. It performs the same function as the LogEntryInfos does for custom tasks. Like the preceding RegisterEvents method, this method generates a new LogEntryInfo at the Data Flow Task level.

PerformUpgrade

This method is only useful when you release a new version of the component. It allows a newer version of a component to update an older version of the same component. If you release a component, and then subsequently want to add a property or output or any other change for that matter, you'll need to implement this method on the component so that it can replace previous versions seamlessly.



Microsoft SQL Server 2005 Integration Services
Microsoft SQL Server 2005 Integration Services
ISBN: 0672327813
EAN: 2147483647
Year: 2006
Pages: 200
Authors: Kirk Haselden

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net