ForEachLoop.PrecedenceConstraints Property
Returns a PrecedenceConstraints collection that contains all of the precedence constraints associated with the ForEachLoop.
Espacio de nombres: Microsoft.SqlServer.Dts.Runtime
Ensamblado: Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)
Sintaxis
'Declaración
Public ReadOnly Property PrecedenceConstraints As PrecedenceConstraints
public PrecedenceConstraints PrecedenceConstraints { get; }
public:
virtual property PrecedenceConstraints^ PrecedenceConstraints {
PrecedenceConstraints^ get () sealed;
}
/** @property */
public final PrecedenceConstraints get_PrecedenceConstraints ()
public final function get PrecedenceConstraints () : PrecedenceConstraints
Valor de propiedad
A PrecedenceConstraints collection.
Notas
The order of execution of the objects in the collection is determined by the PrecedenceConstraints added to the container. PrecedenceConstraints allow execution branching based on the success, failure, or completion of an executable in the collection.
Ejemplo
The following code example creates a ForEachLoop and sets some properties using the Properties collection. Two tasks are added to the Executables collection, and a precedence constraint is put between them.
// 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)
Sample Output:
Number of Executables in ForLoop: 2
Number of precedence constraints: 1
Seguridad para subprocesos
Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Plataformas
Plataformas de desarrollo
Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.
Plataformas de destino
Para obtener una lista de las plataformas compatibles, vea Requisitos de hardware y software para instalar SQL Server 2005.
Vea también
Referencia
ForEachLoop Class
ForEachLoop Members
Microsoft.SqlServer.Dts.Runtime Namespace