IDTSPath100.AttachPathAndPropagateNotifications 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立兩個元件之間的路徑並通知受影響的元件。
public:
void AttachPathAndPropagateNotifications(Microsoft::SqlServer::Dts::Pipeline::Wrapper::IDTSOutput100 ^ pIDTSOutput, Microsoft::SqlServer::Dts::Pipeline::Wrapper::IDTSInput100 ^ pIDTSInput);
[System.Runtime.InteropServices.DispId(104)]
public void AttachPathAndPropagateNotifications(Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSOutput100 pIDTSOutput, Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSInput100 pIDTSInput);
[<System.Runtime.InteropServices.DispId(104)>]
abstract member AttachPathAndPropagateNotifications : Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSOutput100 * Microsoft.SqlServer.Dts.Pipeline.Wrapper.IDTSInput100 -> unit
Public Sub AttachPathAndPropagateNotifications (pIDTSOutput As IDTSOutput100, pIDTSInput As IDTSInput100)
參數
- pIDTSOutput
- IDTSOutput100
上游組件的輸出。
- pIDTSInput
- IDTSInput100
下游元件的輸入。
- 屬性
範例
以下程式碼範例示範如何建立新路徑並建立兩個元件間的路徑。
using System;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Runtime;
...
public static void main( string []args )
{
// Create the package and add a data flow task.
Package p = new Package();
TaskHost th = p.Executables.Add("DTS.Pipeline",null) as TaskHost;
MainPipe m = th.InnerObject as MainPipe;
// Create an OLE DB source component.
IDTSComponentMetaData100 md = AddComponentToDataFlow( m , "DTSAdapter.OLEDBSource");
IDTSComponentMetaData100 oledbSrc = m.ComponentMetaDataCollection.New();
CManagedComponentWrapper100 srcWrp = oledbSrc.Instantiate();
srcWrp.ProvideComponentProperties();
// Create an OLE DB destination component.
IDTSComponentMetaData100 oledbDest = AddComponentToDataFlow( m , "DTSAdapter.OLEDBDestination");
IDTSComponentMetaData100 destWrp = oledbDest.ComponentMetaDataCollection.New();
CManagedComponentWrapper100 destWrp = md.Instantiate();
destWrp.ProvideComponentProperties();
// Establish the path.
IDTSPath100 path = m.PathCollection.New();
path. AttachPathAndPropagateNotifications( oledbSrc.OutputCollection[0], oledbDest.InputCollection[0]);
}
public IDTSComponentMetaData100 AddComponentToDataFlow( MainPipe mp , string Component )
{
if( mp != null )
{
IDTSComponentMetaData100 md = mp.ComponentMetaDataCollection.New();
md.ComponentClassID = Component;
CManagedComponentWrapper wrp = md.Instantiate();
wrp.ProvideComponentProperties();
return md;
}
throw new Exception( "DataFlow task does not exist.");
}
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime
...
Public Shared Sub main(ByVal args As String())
Dim p As Package = New Package
Dim th As TaskHost = CType(ConversionHelpers.AsWorkaround(p.Executables.Add("DTS.Pipeline", Nothing), GetType(TaskHost)), TaskHost)
Dim m As MainPipe = CType(ConversionHelpers.AsWorkaround(th.InnerObject, GetType(MainPipe)), MainPipe)
Dim md As IDTSComponentMetaData100 = AddComponentToDataFlow(m, "DTSAdapter.OLEDBSource")
Dim oledbSrc As IDTSComponentMetaData100 = m.ComponentMetaDataCollection.New
Dim srcWrp As CManagedComponentWrapper100 = oledbSrc.Instantiate
srcWrp.ProvideComponentProperties
Dim oledbDest As IDTSComponentMetaData100 = AddComponentToDataFlow(m, "DTSAdapter.OLEDBDestination")
Dim destWrp As IDTSComponentMetaData100 = oledbDest.ComponentMetaDataCollection.New
Dim destWrp As CManagedComponentWrapper100 = md.Instantiate
destWrp.ProvideComponentProperties
Dim path As IDTSPath100 = m.PathCollection.New
path.AttachPathAndPropagateNotifications(oledbSrc.OutputCollection(0), oledbDest.InputCollection(0))
End Sub
Public Function AddComponentToDataFlow(ByVal mp As MainPipe, ByVal Component As String) As IDTSComponentMetaData100
If Not (mp Is Nothing) Then
Dim md As IDTSComponentMetaData100 = mp.ComponentMetaDataCollection.New
md.ComponentClassID = Component
Dim wrp As CManagedComponentWrapper = md.Instantiate
wrp.ProvideComponentProperties
Return md
End If
Throw New Exception("DataFlow task does not exist.")
End Function
備註
除了建立 與IDTSOutput100IDTSInput100輸入之間的資料流外,此方法也會透過呼叫OnInputPathAttached該元件的 and OnOutputPathAttached 方法來通知每個元件事件。