Udostępnij za pośrednictwem


Metoda IDTSComponentMetaDataCollection100.New

Tworzy nową IDTSComponentMetaData100 obiektu i dodaje go do IDTSComponentMetaDataCollection100 kolekcja.

Przestrzeń nazw:  Microsoft.SqlServer.Dts.Pipeline.Wrapper
Zestaw:  Microsoft.SqlServer.DTSPipelineWrap (w Microsoft.SqlServer.DTSPipelineWrap.dll)

Składnia

'Deklaracja
Function New As IDTSComponentMetaData100
'Użycie
Dim instance As IDTSComponentMetaDataCollection100
Dim returnValue As IDTSComponentMetaData100

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

Uwagi

Składniki przepływu danych są dodawane do MainPipe klasy wywołując New metoda ComponentMetaDataCollection.

Przykłady

W następującym przykładzie kodu dodano składnik OLE DB źródła zadanie przepływ danych przez wywołanie New metoda MainPipe klasy

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();
            }
        }
    }
}