IDTSComponentMetaDataCollection100.New 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public:
Microsoft::SqlServer::Dts::Pipeline::Wrapper::Sql2012::IDTSComponentMetaData100 ^ New();
[System.Runtime.InteropServices.DispId(14)]
public Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2012.IDTSComponentMetaData100 New ();
[<System.Runtime.InteropServices.DispId(14)>]
abstract member New : unit -> Microsoft.SqlServer.Dts.Pipeline.Wrapper.Sql2012.IDTSComponentMetaData100
Public Function New () As IDTSComponentMetaData100
返回
新创建的 IDTSComponentMetaData100 对象。
- 属性
示例
下面的代码示例通过调用 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("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();
}
}
}
}
注解
数据流组件通过调用 ComponentMetaDataCollection 的 New 方法添加到 MainPipe 类。