我正在尝试在我的托管代码中实现自定义数据流组件。这是我的自定义数据流组件:
[DtsPipelineComponent(DisplayName = "RenameComponent", ComponentType = ComponentType.Transform)]
public class MapperComponent : PipelineComponent
{
List<IDTSVirtualInputColumn100> dontMapList;
public override void ProvideComponentProperties()
{
base.ProvideComponentProperties();
base.RemoveAllInputsOutputsAndCustomProperties();
IDTSInput100 input = ComponentMetaData.InputCollection.New();
input.Name = "Input";
IDTSOutput100 output = ComponentMetaData.OutputCollection.New();
output.Name = "Output";
output.SynchronousInputID = input.ID;
// Make the output asynchronous
output.SynchronousInputID = 0;
FindOldColumns(input);
}
}
我编译它,将它注册到 gac,并将它保存到 C:\Program Files\Microsoft SQL Server\100\DTS\PipelineComponents 目录。
然后我运行以下代码将组件添加到我的数据流任务中:
private static IDTSComponentMetaData100 CreateRenameTransformation(MainPipe dataFlow, Train train)
{
IDTSComponentMetaData100 renameTransformation = dataFlow.ComponentMetaDataCollection.New();
// Set stock properties
renameTransformation.ComponentClassID = "Dexter.CustomComponents.MapperComponent";
renameTransformation.Name = "RenameTransformation";
renameTransformation.Description = "Rename and remove incompatible columns";
CManagedComponentWrapper instance = renameTransformation.Instantiate();
instance.ProvideComponentProperties();
return renameTransformation as IDTSComponentMetaData100;
}
在运行时(当我尝试创建 pacakge 时),我收到以下错误:0xC0048021 -1073446879 DTS_E_ERRORCOMPONENT 组件丢失、未注册、不可升级或缺少所需的接口。此组件的联系信息是“%1”。
谢谢,