如何获取 IDTSComponentMetadata100 的 PipelineComponent

发布于 2024-10-31 22:59:58 字数 131 浏览 0 评论 0原文

我正在为 SSIS 自定义管道组件编写 UI 编辑器。

当 BIDS 调用编辑器时,它将 IDTSComponentMetadata100 实例传递给编辑器。如何获取对我的(托管)PipelineComponent 派生实例的引用?

I'm writing a UI editor for an SSIS custom pipeline component.

When BIDS invokes the editor, it passes a IDTSComponentMetadata100 instance to the editor. How do I get a reference to my (managed) PipelineComponent derived instance?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

对你的占有欲 2024-11-07 22:59:58

我相信您想做这样的事情:

void Initialize(
    IDTSComponentMetaData100 dtsComponentMetadata,
    IServiceProvider serviceProvider
){
    IDtsPipelineEnvironmentService pipelineService = (IDtsPipelineEnvironmentService)serviceProvider.GetService(typeof(IDtsPipelineEnvironmentService));
    IDTSPipeline100 mainPipe = pipelineService.Pipeline;
    // access mainPipe.PathCollection etc
    TaskHost pipelineTaskHost = pipelineService.PipelineTaskHost;
    MainPipe mainPipe2 = pipelineTaskHost.InnerObject as MainPipe;
    // that is less direct but should work too
}

您可以使用 serviceProvider 做其他有趣的事情,例如通过将不同的类型传递给 GetService 来检查包的连接或变量。有关详细信息,请参阅 SQL2008R2 BOL

I believe that you want to do something like this:

void Initialize(
    IDTSComponentMetaData100 dtsComponentMetadata,
    IServiceProvider serviceProvider
){
    IDtsPipelineEnvironmentService pipelineService = (IDtsPipelineEnvironmentService)serviceProvider.GetService(typeof(IDtsPipelineEnvironmentService));
    IDTSPipeline100 mainPipe = pipelineService.Pipeline;
    // access mainPipe.PathCollection etc
    TaskHost pipelineTaskHost = pipelineService.PipelineTaskHost;
    MainPipe mainPipe2 = pipelineTaskHost.InnerObject as MainPipe;
    // that is less direct but should work too
}

You can do other interesting things with the serviceProvider, like inspecting the package's connections or variables, by passing a different type to GetService. See SQL2008R2 BOL for details.

め七分饶幸 2024-11-07 22:59:58

尝试通过管道服务进行路由,但我的自定义数据流组件(用 C# 开发)不在 IDTSPipeline100.PathCollection 中 - 标准的 Microsoft 组件在 IDTSPipeline100.PathCollection 中。

更深入地挖掘,我尝试让 mainPipe.GetObjectByID(componentID) 有效,但它返回一个 COM 对象而不是 C#/托管对象。尝试强制转换会引发“无法从 COM 强制转换为 C#Managed”异常。

我无法确认,但强烈怀疑我的 C#/托管自定义组件没有显示在 PathCollection 中,因为它们是 C#/托管组件与 COM。

Tried the route via the pipeline service, but my custom data flow components (developed in C#) were not in the IDTSPipeline100.PathCollection - the standard Microsoft ones were.

Digging a bit deeper, I tried getting mainPipe.GetObjectByID(componentID) which works, but it returns a COM object not a C#/Managed object. Attempting to cast throws a "you can't cast from COM to C#Managed" exception.

I can't confirm, but strongly suspect that my C#/Managed custom components don't show up in the PathCollection as they are C#/Managed component vs. COM.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文