Programowe łączenie składników przepływu danych

Dotyczy:SQL Server Środowisko SSIS Integration Runtime w usłudze Azure Data Factory

Po dodaniu komponentów do zadania przepływu danych, łączysz je, tworząc drzewo wykonawcze, które reprezentuje przepływ danych ze źródeł przez transformacje do miejsc docelowych. Używasz IDTSPath100 obiektów do łączenia komponentów w przepływie danych.

Tworzenie ścieżki

Wywołaj nową metodę PathCollection właściwości interfejsu MainPipe , aby utworzyć nową ścieżkę i dodać ją do zbioru ścieżek w zadaniu przepływu danych. Ta metoda zwraca nowy, odłączony IDTSPath100 obiekt, który następnie używasz do połączenia dwóch komponentów.

Wywołaj metodę AttachPathAndPropagateNotifications połączenia ścieżki i powiadomienie komponentów uczestniczących w ścieżce, że zostały połączone. Metoda ta przyjmuje parametry, a komponentu IDTSOutput100 upstream oraz komponent IDTSInput100 downstream. Domyślnie wywołanie metody komponentu ProvideComponentProperties tworzy pojedyncze wejście dla komponentów, które mają wejścia, oraz jedno wyjście dla komponentów, które mają wyjścia. Poniższy przykład wykorzystuje to domyślne wyjście źródła i wejście celu.

Przykład

Poniższy przykład kodu pokazuje, jak ustanowić ścieżkę między dwoma komponentami.

using System;  
using Microsoft.SqlServer.Dts.Runtime;  
using Microsoft.SqlServer.Dts.Pipeline;  
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;  
  
namespace Microsoft.SqlServer.Dts.Samples  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
      Package package = new Package();  
      Executable e = package.Executables.Add("STOCK:PipelineTask");  
      TaskHost thMainPipe = e as TaskHost;  
      MainPipe dataFlowTask = thMainPipe.InnerObject as MainPipe;  
  
      // Create the source component.    
      IDTSComponentMetaData100 source =  
        dataFlowTask.ComponentMetaDataCollection.New();  
      source.ComponentClassID = "DTSAdapter.OleDbSource";  
      CManagedComponentWrapper srcDesignTime = source.Instantiate();  
      srcDesignTime.ProvideComponentProperties();  
  
      // Create the destination component.  
      IDTSComponentMetaData100 destination =  
        dataFlowTask.ComponentMetaDataCollection.New();  
      destination.ComponentClassID = "DTSAdapter.OleDbDestination";  
      CManagedComponentWrapper destDesignTime = destination.Instantiate();  
      destDesignTime.ProvideComponentProperties();  
  
      // Create the path.  
      IDTSPath100 path = dataFlowTask.PathCollection.New();  
      path.AttachPathAndPropagateNotifications(source.OutputCollection[0],  
        destination.InputCollection[0]);  
    }  
  }  

}

Imports Microsoft.SqlServer.Dts.Runtime  
Imports Microsoft.SqlServer.Dts.Pipeline  
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper  
  
Module Module1  
  
  Sub Main()  
  
    Dim package As Microsoft.SqlServer.Dts.Runtime.Package = _  
      New Microsoft.SqlServer.Dts.Runtime.Package()  
    Dim e As Executable = package.Executables.Add("STOCK:PipelineTask")  
    Dim thMainPipe As Microsoft.SqlServer.Dts.Runtime.TaskHost = _  
      CType(e, Microsoft.SqlServer.Dts.Runtime.TaskHost)  
    Dim dataFlowTask As MainPipe = CType(thMainPipe.InnerObject, MainPipe)  
  
    ' Create the source component.    
    Dim source As IDTSComponentMetaData100 = _  
      dataFlowTask.ComponentMetaDataCollection.New()  
    source.ComponentClassID = "DTSAdapter.OleDbSource"  
    Dim srcDesignTime As CManagedComponentWrapper = source.Instantiate()  
    srcDesignTime.ProvideComponentProperties()  
  
    ' Create the destination component.  
    Dim destination As IDTSComponentMetaData100 = _  
      dataFlowTask.ComponentMetaDataCollection.New()  
    destination.ComponentClassID = "DTSAdapter.OleDbDestination"  
    Dim destDesignTime As CManagedComponentWrapper = destination.Instantiate()  
    destDesignTime.ProvideComponentProperties()  
  
    ' Create the path.  
    Dim path As IDTSPath100 = dataFlowTask.PathCollection.New()  
    path.AttachPathAndPropagateNotifications(source.OutputCollection(0), _  
      destination.InputCollection(0))  
  
  End Sub  
  
End Module