Reputation: 9428
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?
Upvotes: 1
Views: 887
Reputation: 1
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.
Upvotes: 0
Reputation: 557
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.
Upvotes: 2