Dil

Veri Akışı Bileşenlerini Program Aracılığıyla Bağlama

Şunlar için geçerlidir:SQL Server Azure Data Factory'de SSIS Tümleştirme Çalışma Zamanı

Veri akışı görevine bileşenler ekledikten sonra, onları bağlayarak kaynaklardan dönüşümler yoluyla hedeflere veri akışını temsil eden bir yürütme ağacı oluşturursunuz. Veri akışındaki bileşenleri bağlamak için nesneler kullanırsınız IDTSPath100 .

Bir Yol Yaratmak

Arayüz özelliğinin MainPipe Yeni yöntemini PathCollection çağırarak yeni bir yol oluşturun ve veri akışı görevindeki yollar koleksiyonuna ekleyin. Bu yöntem yeni, bağlantısız IDTSPath100 bir nesne döndürür ve ardından iki bileşeni bağlamak için kullanılır.

Yolu bağlamak ve yola katılan bileşenlere bağlandıklarını bildirmek için yöntemi AttachPathAndPropagateNotifications çağırın. Bu yöntem, yukarı akış bileşeninden birini IDTSOutput100 ve IDTSInput100 aşağı akış bileşeninden birini parametre olarak kabul eder. Varsayılan olarak, bileşen ProvideComponentProperties yöntemine yapılan çağrı, girdi olan bileşenler için tek bir giriş ve çıktısı olan bileşenler için tek bir çıktı oluşturur. Aşağıdaki örnek, hedefin kaynağı ve girdisinin varsayılan çıktısını kullanır.

Sample

Aşağıdaki kod örneği, iki bileşen arasında bir yol nasıl kurulacağını gösterir.

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