public class ben:harrell

September 18, 2007

SSIS Custom Component – ProvideComponentProperties vs ReInitializeMetadata

Filed under: .NET, Custom Source Component, Integration Servicees, SQL Server 2005, SSIS, Technology, database — benjamin harrell @ 9:47 am

 

I am currently working on a custom source component in SSIS that converts EBCDIC data to ASCII inline and one of the challenges I face is creating dynamic outputs and output columns based on the layout process of the source component.  Normally, when you want to additional outputs on your component you create them in by override ProvideComponentProperties like this:

public override void ProvideComponentProperties()
{
    // add the outputComponentMetaData.UsesDispositions = true;
   IDTSOutput90 output =     ComponentMetaData.OutputCollection.New();
   output.Name = “My New Output”;
   output.ExternalMetadataColumnCollection.IsUsed = true;

This works really well if all of your output information is available at design time (in the SSIS ui) but what happens if your dynamic outputs are determined at runtime?  ProvideComponentProperties is only called one time, when the component is added to designer surface.  In order to dynamically add outputs at a later point you must use ReInitializeMetaData which is called whenever Validate returns VS_NEEDSNEWMETADATA.

public override void ReinitializeMetaData()
{
   // add the output
   ComponentMetaData.UsesDispositions = true;
   IDTSOutput90 output = ComponentMetaData.OutputCollection.New();
   output.Name = “My New Output”;
   output.ExternalMetadataColumnCollection.IsUsed = true;
 }
 

Note that I have not shown the additional work of adding columns to either of these scenarios, you will need to add that code yourself. 

2 Comments »

  1. I found this when I randomly was googling old friends names. Looks like you’re doing well (although I have no clue what this all means). Just wanted to say hi.

    Comment by boolie — November 5, 2007 @ 1:56 pm

  2. Just wanted to try and get some more information about Lysine…this is exactly what we’ve been looking for in regards to converting our EBCDIC files in SSIS and dumping them into SQL. When I go to the site, it is just a bit of marketing fluff?!

    Comment by Aaron Corcoran — April 25, 2008 @ 2:56 pm


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.