【发布时间】:2013-03-19 13:02:11
【问题描述】:
我正在使用工具 (C#.Net) 来分析 SSIS 包。
在这里,我使用Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSComponentMetaData100(dts.interop 中的类) 类来迭代数据流任务(MainPipe)。请在下面找到代码。
//Cast the Executable as a data flow
MainPipe pipe = (MainPipe)taskHost.InnerObject;
foreach (IDTSComponentMetaData100 comp in pipe.ComponentMetaDataCollection)
{
//Here i need
//1. Source details
//2. Destination details
}
是否可以将每个 IDTSComponentMetaData100 对象类型转换为 XMLSource、OLEDB Destination 等数据流组件的某些对象?如果可能,我将如何识别来源、目的地等?
如果不可能,请提供一些提示来实现这一点。
【问题讨论】:
-
谢谢普拉文。这就是我们可以动态创建包的方式,但我需要分析包。下面的代码将创建一个 IDTSComponentMetaData100 的实例作为 OleDbDestination。 IDTSComponentMetaData100 destComponent = pipeline.ComponentMetaDataCollection.New(); destComponent.ComponentClassID = "DTSAdapter.OleDbDestination"; destComponent.ValidateExternalMetadata = true;但我需要通过数据流循环提取 OleDbDestination。请帮忙...