MainPipeClass.GetNextPasteID 方法

定义

获取数据流任务生成的下一个可用 ID。

public:
 virtual int GetNextPasteID() = Microsoft::SqlServer::Dts::Pipeline::Wrapper::IDTSPipeline100::GetNextPasteID;
[System.Runtime.InteropServices.DispId(126)]
public virtual int GetNextPasteID ();
[<System.Runtime.InteropServices.DispId(126)>]
abstract member GetNextPasteID : unit -> int
override this.GetNextPasteID : unit -> int
Public Overridable Function GetNextPasteID () As Integer

返回

数据流布局中下一个可用的唯一 ID。

实现

属性

示例

下面的代码示例演示如何按顺序创建分配给数据流对象的 ID。

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

namespace Microsoft.Samples.SqlServer.Dts  
{  
    public class Class1  
    {  
        public static void Main(string []args)  
        {  
            Package p = new Package();  
            MainPipe mp = ((TaskHost)p.Executables.Add("DTS.Pipeline")).InnerObject as MainPipe;  
            for(int x=0; x<10; x++)  
            {  
                Console.WriteLine("NextPasteID: " + mp.GetNextPasteID());  
                Console.WriteLine("MetaDataID: " + mp. ComponentMetaDataCollection.New().ID);  
            }  
        }  
    }  

}  
Imports System   
Imports Microsoft.SqlServer.Dts.Runtime   
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper   
Namespace Microsoft.Samples.SqlServer.Dts   

 Public Class Class1   

   Public Shared Sub Main(ByVal args As String())   
     Dim p As Package = New Package   
     Dim mp As MainPipe = CType(CType(p.Executables.Add("DTS.Pipeline"), TaskHost).InnerObject, MainPipe)   
     Dim x As Integer = 0   
     While x < 10   
       Console.WriteLine("NextPasteID: " + mp.GetNextPasteID)   
       Console.WriteLine("MetaDataID: " + mp.ComponentMetaDataCollection.New.ID)   
       System.Math.Min(System.Threading.Interlocked.Increment(x),x-1)   
     End While   
   End Sub   
 End Class   
End Namespace  

上述代码生成以下输出。

NextPasteID: 1

MetaDataID:2

NextPasteID: 3

MetaDataID:4

NextPasteID:5

MetaDataID:6

NextPasteID: 7

MetaDataID:8

NextPasteID: 9

MetaDataID:10

NextPasteID:11

MetaDataID:12

NextPasteID:13

MetaDataID:14

NextPasteID:15

MetaDataID:16

NextPasteID:17

MetaDataID:18

NextPasteID:19

MetaDataID:20

注解

数据流任务按顺序生成对象 ID。 此方法检索下一个可用唯一 ID 和增量。

适用于