共用方式為


以程式設計方式探索資料流程元件

適用於:Azure Data Factory 中的 SQL Server SSIS Integration Runtime

在將資料流程工作加入封裝之後,下一步可能就是要判斷有哪些資料流程元件可供您使用。 您可以使用程式設計方式探索安裝在本機電腦上可供使用的資料流程來源、轉換和目的地。 如需將資料流程工作新增套件的資訊,請參閱以程式設計方式新增資料流程工作

探索元件

Application 類別提供 PipelineComponentInfos 集合,其中包含每個正確安裝在本機電腦之元件的 PipelineComponentInfo 物件。 每個 PipelineComponentInfo 都包含元件的相關資訊,例如其名稱、描述和建立名稱。 當您將元件加入封裝時,可以使用在 CreationName 屬性中傳回的值,以設定 ComponentClassIDIDTSComponentMetaData100 屬性。

後續步驟

在探索可用的元件之後,下一個步驟是新增和設定元件,這將在下一主題中討論:以程式設計方式新增資料流程元件

範例

下列程式碼範例會示範如何列舉 PipelineComponentInfos 物件的 Application 集合,以程式設計方式探索在本機電腦上可用的資料流程元件。 這個範例需要 Microsoft.SqlServer.ManagedDTS 組件的參考。

using System;  
using Microsoft.SqlServer.Dts.Runtime;  
  
namespace Microsoft.SqlServer.Dts.Samples  
{  
  class Program  
  {  
    static void Main(string[] args)  
    {  
      Application application = new Application();  
      PipelineComponentInfos componentInfos = application.PipelineComponentInfos;  
  
      foreach (PipelineComponentInfo componentInfo in componentInfos)  
      {  
        Console.WriteLine("Name: " + componentInfo.Name + "\n" +  
          " CreationName: " + componentInfo.CreationName + "\n");  
      }  
      Console.Read();  
    }  
  }  
}  
Imports Microsoft.SqlServer.Dts.Runtime  
  
Module Module1  
  
  Sub Main()  
  
    Dim application As Application = New Application()  
  
    Dim componentInfos As PipelineComponentInfos = application.PipelineComponentInfos  
  
    For Each componentInfo As PipelineComponentInfo In componentInfos  
      Console.WriteLine("Name: " & componentInfo.Name & vbCrLf & _  
        " CreationName: " & componentInfo.CreationName & vbCrLf)  
    Next  
  
    Console.Read()  
  
  End Sub  
  
End Module  

另請參閱

以程式設計方式加入資料流程元件