ForEachLoop.PrecedenceConstraints プロパティ

定義

PrecedenceConstraints に関連付けられたすべての優先順位制約を含む ForEachLoop コレクションを返します。

public:
 property Microsoft::SqlServer::Dts::Runtime::PrecedenceConstraints ^ PrecedenceConstraints { Microsoft::SqlServer::Dts::Runtime::PrecedenceConstraints ^ get(); };
public Microsoft.SqlServer.Dts.Runtime.PrecedenceConstraints PrecedenceConstraints { get; }
member this.PrecedenceConstraints : Microsoft.SqlServer.Dts.Runtime.PrecedenceConstraints
Public ReadOnly Property PrecedenceConstraints As PrecedenceConstraints

プロパティ値

PrecedenceConstraints コレクション。

実装

次のコード例では、ForEachLoop を作成し、Properties コレクションを使用していくつかのプロパティを設定します。 Executables コレクションに 2 つのタスクを追加し、これらのタスク間に優先順位制約を設定します。

// Create the package.  
Package package = new Package();  
// Add variables.  
package.Variables.Add("Id", false, "User", 0);  

// Create ForEachLoop task  
Executables executables = package.Executables;  
ForEachLoop forEachLoop = executables.Add("STOCK:FOREACHLOOP") as ForEachLoop;  

// The ForEachLoop is a container. Add some task executables and  
// create a precedence constraint. The tasks can run when  
// certain conditions in the loop are met.  
TaskHost thLoopMail = (TaskHost)forEachLoop.Executables.Add("STOCK:SendMailTask");  
TaskHost thLoopInsert = (TaskHost)forEachLoop.Executables.Add("STOCK:BulkInsertTask");  
Executables loopExecs = forEachLoop.Executables;  
Console.WriteLine("Number of Executables in ForLoop: {0}", loopExecs.Count);  

// Like other containers, precedence constraints can be set on the  
// contained tasks.  
PrecedenceConstraint pc = forEachLoop.PrecedenceConstraints.Add((Executable)thLoopMail, thLoopInsert);  
PrecedenceConstraints pcs = forEachLoop.PrecedenceConstraints;  
Console.WriteLine("Number of precedence constraints: {0}", pcs.Count);  
' Create the package.  
Dim package As Package =  New Package()   
' Add variables.  
package.Variables.Add("Id", False, "User", 0)  

' Create ForEachLoop task  
Dim executables As Executables =  package.Executables   
Dim forEachLoop As ForEachLoop =  executables.Add("STOCK:FOREACHLOOP") as ForEachLoop   

' The ForEachLoop is a container. Add some task executables and  
' create a precedence constraint. The tasks can run when  
' certain conditions in the loop are met.  
Dim thLoopMail As TaskHost = CType(forEachLoop.Executables.Add("STOCK:SendMailTask"), TaskHost)  
Dim thLoopInsert As TaskHost = CType(forEachLoop.Executables.Add("STOCK:BulkInsertTask"), TaskHost)  
Dim loopExecs As Executables =  forEachLoop.Executables   
Console.WriteLine("Number of Executables in ForLoop: {0}", loopExecs.Count)  

' Like other containers, precedence constraints can be set on the  
' contained tasks.  
Dim pc As PrecedenceConstraint =  forEachLoop.PrecedenceConstraints.Add(CType(thLoopMail,thLoopInsert, Executable))   
Dim pcs As PrecedenceConstraints =  forEachLoop.PrecedenceConstraints   
Console.WriteLine("Number of precedence constraints: {0}", pcs.Count)  

サンプル出力:

Number of Executables in ForLoop: 2

Number of precedence constraints: 1

注釈

コレクション内のオブジェクトの実行順序は、コンテナーに追加された PrecedenceConstraints によって決定されます。 PrecedenceConstraints により、コレクション内の実行可能オブジェクトの成功、失敗、または完了を基に実行を分岐できます。

適用対象