IDTSSequence.PrecedenceConstraints 속성
Returns a collection of PrecedenceConstraint objects associated with the container. This field is read-only.
네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)
구문
‘선언
ReadOnly Property PrecedenceConstraints As PrecedenceConstraints
Get
‘사용 방법
Dim instance As IDTSSequence
Dim value As PrecedenceConstraints
value = instance.PrecedenceConstraints
PrecedenceConstraints PrecedenceConstraints { get; }
property PrecedenceConstraints^ PrecedenceConstraints {
PrecedenceConstraints^ get ();
}
abstract PrecedenceConstraints : PrecedenceConstraints
function get PrecedenceConstraints () : PrecedenceConstraints
속성 값
유형: Microsoft.SqlServer.Dts.Runtime.PrecedenceConstraints
A PrecedenceConstraints collection that contains PrecedenceConstraint objects for the container.
주의
Precedence constraints establish the order that executable objects run in a package. The precedence constraint allows the control of execution of the containers and tasks in a package to be based on the result of the execution of a previous task or container. Precedence constraints are established between two Executable objects by calling the Add method of the PrecedenceConstraints collection on the container object. After creating a constraint between two executable objects, the Value property is set to establishes the criteria for executing the second executable defined in the constraint.
예
The Package class inherits from IDTSSequence and implements an PrecedenceConstraints collection The following code sample demonstrates adding two tasks to a package. A PrecedenceConstraint is added to the PrecedenceConstraints collection. The constraint created between the tasks prevents the second task from running until the first task completes.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Pipeline.Wrapper;
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;
namespace DataFlow_Conceptual
{
class Program
{
static void Main(string[] args)
{
Package p = new Package();
// Add a File System task.
Executable eFileTask1 = p.Executables.Add("STOCK:FileSystemTask");
TaskHost thFileHost1 = eFileTask1 as TaskHost;
// Add a second File System task.
Executable eFileTask2 = p.Executables.Add("STOCK:FileSystemTask");
TaskHost thFileHost2 = eFileTask2 as TaskHost;
// Put a precedence constraint between the tasks.
// Set the constraint to be that thFileTask2 cannot run
// until thFileTask1 completes.
PrecedenceConstraint pcFileTasks = p.PrecedenceConstraints.Add((Executable)thFileHost1, (Executable) thFileHost2);
pcFileTasks.Value = DTSExecResult.Completion;
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
Namespace DataFlow_Conceptual
Class Program
Shared Sub Main(ByVal args() As String)
Dim p As Package = New Package()
' Add a File System task.
Dim eFileTask1 As Executable = p.Executables.Add("STOCK:FileSystemTask")
Dim thFileHost1 As TaskHost = eFileTask1 as TaskHost
' Add a second File System task.
Dim eFileTask2 As Executable = p.Executables.Add("STOCK:FileSystemTask")
Dim thFileHost2 As TaskHost = eFileTask2 as TaskHost
' Put a precedence constraint between the tasks.
' Set the constraint to be that thFileTask2 cannot run
' until thFileTask1 completes.
Dim pcFileTasks As PrecedenceConstraint = p.PrecedenceConstraints.Add(CType(thFileHost1,CType(thFileHost2, Executable, Executable)))
pcFileTasks.Value = DTSExecResult.Completion
End Sub
End Class
End Namespace