title | description | author | ms.author | ms.date | ms.service | ms.subservice | ms.topic | helpviewer_keywords | dev_langs | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Creating a Custom Data Flow Component |
Creating a Custom Data Flow Component |
chugugrace |
chugu |
03/14/2017 |
sql |
integration-services |
reference |
|
|
[!INCLUDEsqlserver-ssis]
In [!INCLUDEmsCoName] [!INCLUDEssNoVersion] [!INCLUDEssISnoversion], the data flow task exposes an object model that lets developers create custom data flow components-sources, transformations, and destinations-by using the [!INCLUDEmsCoName] [!INCLUDEdnprdnshort] and managed code.
A data flow task consists of components that contain an xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100 interface and a collection of xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSPath100 objects that define the movement of data between components.
Note
When you create a custom provider, you need to update the ProviderDescriptors.xml file with the metadata column values.
Before execution, the data flow task is said to be in a design-time state, as it undergoes incremental changes. Changes may include the addition or removal of components, the addition or removal of the path objects that connect components, and changes to the metadata of the components. When metadata changes occur, the component can monitor and react to the changes. For example, a component can disallow certain changes or to make additional changes in response to a change. At design time, the designer interacts with a component through the design-time xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSDesigntimeComponent100 interface.
At execution time, the data flow task examines the sequence of components, prepares an execution plan, and manages a pool of worker threads that execute the work plan. Although each worker thread performs some work that is internal to the data flow task, the principal task of the worker thread is to call the methods of the component through the run-time xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSRuntimeComponent100 interface.
To create a data flow component, you derive a class from the xref:Microsoft.SqlServer.Dts.Pipeline.PipelineComponent base class, apply the xref:Microsoft.SqlServer.Dts.Pipeline.DtsPipelineComponentAttribute class, and then override the appropriate methods of the base class. The xref:Microsoft.SqlServer.Dts.Pipeline.PipelineComponent implements the xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSDesigntimeComponent100 and xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSRuntimeComponent100 interfaces, and exposes their methods for you to override in your component.
Depending on the objects used by your component, your project will require references to some or all of the following assemblies:
Feature | Assembly to reference | Namespace to import |
---|---|---|
Data flow | Microsoft.SqlServer.PipelineHost | xref:Microsoft.SqlServer.Dts.Pipeline |
Data flow wrapper | Microsoft.SqlServer.DTSPipelineWrap | xref:Microsoft.SqlServer.Dts.Pipeline.Wrapper |
Runtime | Microsoft.SQLServer.ManagedDTS | xref:Microsoft.SqlServer.Dts.Runtime |
Runtime wrapper | Microsoft.SqlServer.DTSRuntimeWrap | xref:Microsoft.SqlServer.Dts.Runtime.Wrapper |
The following code example shows a simple component that derives from the base class, and applies the xref:Microsoft.SqlServer.Dts.Pipeline.DtsPipelineComponentAttribute. You need to add a reference to the Microsoft.SqlServer.DTSPipelineWrap assembly.
using System;
using Microsoft.SqlServer.Dts.Pipeline;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
namespace Microsoft.Samples.SqlServer.Dts
{
[DtsPipelineComponent(DisplayName = "SampleComponent", ComponentType = ComponentType.Transform )]
public class BasicComponent: PipelineComponent
{
// TODO: Override the base class methods.
}
}
Imports Microsoft.SqlServer.Dts.Pipeline
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
<DtsPipelineComponent(DisplayName:="SampleComponent", ComponentType:=ComponentType.Transform)> _
Public Class BasicComponent
Inherits PipelineComponent
' TODO: Override the base class methods.
End Class