次の方法で共有


New メソッド

新しい IDTSComponentMetaData100 オブジェクトを作成して、IDTSComponentMetaDataCollection100 コレクションに追加します。

名前空間:  Microsoft.SqlServer.Dts.Pipeline.Wrapper
アセンブリ:  Microsoft.SqlServer.DTSPipelineWrap (Microsoft.SqlServer.DTSPipelineWrap.dll)

構文

'宣言
Function New As IDTSComponentMetaData100
'使用
Dim instance As IDTSComponentMetaDataCollection100
Dim returnValue As IDTSComponentMetaData100

returnValue = instance.New()
IDTSComponentMetaData100 New()
IDTSComponentMetaData100^ New()
abstract New : unit -> IDTSComponentMetaData100 
function New() : IDTSComponentMetaData100

戻り値

型: Microsoft.SqlServer.Dts.Pipeline.Wrapper. . :: . .IDTSComponentMetaData100
新しく作成された IDTSComponentMetaData100 オブジェクトです。

説明

ComponentMetaDataCollection の New メソッドを呼び出すことにより、データ フロー コンポーネントが MainPipe クラスに追加されます。

使用例

次のコード例では、MainPipe クラスの New メソッドを呼び出すことにより、OLE DB ソース コンポーネントをデータ フロー タスクに追加しています。

using System;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;

namespace Microsoft.Samples.SqlServer.Dts
{
    class CreateComponent
    {
         [STAThread]
        static void Main(string[] args)
        {
            // Create the package.
            Package p = new Package();

            // Add the data flow task to the package.
            MainPipe dataFlowTask = ((TaskHost)p.Executables.Add("SSIS.Pipeline.2")).InnerObject as MainPipe;

            if (dataFlowTask != null)
            {
                // Add a component to the data flow task.
                IDTSComponentMetaData100 metaData = dataFlowTask.ComponentMetaDataCollection.New();

                // Set the class ID of the component.
                metaData.ComponentClassID = "DTSAdapter.OLEDBSource.1";

                // Create an instance of the component.
                CManagedComponentWrapper wrapper = metaData.Instantiate();

                // Initialize the component.
                wrapper.ProvideComponentProperties();
            }
        }
    }
}