1

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;
Hadi
  • 36,233
  • 13
  • 65
  • 124
  • Please provide some more details about what you are trying to do, any errors you are seeing, etc. Check out [ask] and [help/on-topic]. – Tim Hutchison Jun 09 '17 at 19:55
  • The Code I posted in the question doesn't work, it is intended to represent the creation of a DataFlowTask and the setting of the AutoAdjustBufferSize property. – Greg Spillman Jun 09 '17 at 20:58
  • The question I need an answer to is: does anyone know how to do this? The property doesn't appear in intellisense, and trying to set it won't work. Of course, I can always set the property once the code has run to create the ssis package (using the IDE). But the requirement is to set the property before the package is created, not after the fact. – Greg Spillman Jun 09 '17 at 21:01

1 Answers1

1

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

Sam Kolli
  • 391
  • 3
  • 8
  • One more option is `taskHost.Properties["AutoAdjustBufferSize"].SetValue(taskHost, true);` – Alsin Nov 06 '20 at 13:41