Search code examples
c#ssisdataflowtask

How to programmatically set the AutoAdjustBufferSize property for a DataFlow?


How to programmatically set the AutoAdjustBufferSize property for a DataFlow? I.e.

MainPipe mp = ((TaskHost)p.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;
mp.AutoAdjustBufferSize = true;

Solution

  • MainPipe only implements the IDTSPipeline100 interface. AutoAdjustBufferSize is not available on the IDTSPipeline100 interface but is available on the IDTSPipeline130 interface. Thus you could do one of the following:

    IDTSPipeline130 mp = ((TaskHost)p.Executables.Add("DTS.Pipeline")).InnerObject as IDTSPipeline130;
    mp.AutoAdjustBufferSize = true;
    

    OR

    MainPipe mp = ((TaskHost)p.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;
    (mp as IDTSPipeline130).AutoAdjustBufferSize = true;
    

    The "130" classes/interfaces extend some of the SSIS functionality, but for only SQL Server 2016+; the IDTSPipeline130 itnerface will be available if you added the v4.0_13.0.0.0 version of the Microsoft.SQLServer.DTSPipelineWrap assembly