IDTSComponentMetaDataCollection100.New 方法

定义

public:
 Microsoft::SqlServer::Dts::Pipeline::Wrapper::Sql2014::IDTSComponentMetaData100 ^ New();
[System.Runtime.InteropServices.DispId(14)]
public Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2014.IDTSComponentMetaData100 New ();
[<System.Runtime.InteropServices.DispId(14)>]
abstract member New : unit -> Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2014.IDTSComponentMetaData100
Public Function New () As IDTSComponentMetaData100

返回

新创建的 IDTSComponentMetaData100 对象。

属性

示例

下面的代码示例通过调用类的新 MainPipe 方法将 OLE DB 源组件添加到数据流任务。

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

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("DTS.Pipeline.1")).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();  
            }  
        }  
    }  
}  
See Also  
IDTSComponentMetaDataCollection100 Interface  
Microsoft.SqlServer.Dts.Pipeline.Wrapper Namespace  
Return to top  

注解

数据流组件通过调用 New 方法ComponentMetaDataCollection添加到MainPipe类中。

适用于