DTSPrecedenceEvalOp 열거형
Indicates the evaluation operations that the precedence constraint uses.
네임스페이스: Microsoft.SqlServer.Dts.Runtime
어셈블리: Microsoft.SqlServer.ManagedDTS(Microsoft.SqlServer.ManagedDTS.dll)
구문
‘선언
Public Enumeration DTSPrecedenceEvalOp
‘사용 방법
Dim instance As DTSPrecedenceEvalOp
public enum DTSPrecedenceEvalOp
public enum class DTSPrecedenceEvalOp
type DTSPrecedenceEvalOp
public enum DTSPrecedenceEvalOp
멤버
멤버 이름 | 설명 | |
---|---|---|
Constraint | Specifies that the execution outcome determines whether the constrained container or task runs. Set the Value property of the PrecedenceConstraint to the desired value from the DTSExecResult enumeration. | |
Expression | Specifies that the value of an expression determines whether the constrained container or task runs. Set the Expression property of the PrecedenceConstraint. | |
ExpressionAndConstraint | Specifies that the constraint outcome must occur and the expression must evaluate for the constrained container or task to run. Set both the Value and the Expression properties of the PrecedenceConstraint, and set its LogicalAnd property to true. | |
ExpressionOrConstraint | Specifies that either the constraint outcome must occur, or the expression must evaluate, for the constrained container or task to run. Set both the Value and the Expression properties of the PrecedenceConstraint, and set its LogicalAnd property to false. |
주의
The precedence item is the task or container whose expression or execution outcome (completion, success, or failure) determines whether the next task or container, the constrained item, runs. The default value is Constraint. For more information, see 선행 제약 조건.
예
The following code example creates three tasks, and places precedence constraints between them. Using the PrecedenceConstraints collection, it iterates over the constraints in the package, displaying information about each constraint, including the EvalOp property, which contains one of the values from this enumeration. The code example then changes the value of EvalOp using this enumeration.
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
using Microsoft.SqlServer.Dts.Tasks.BulkInsertTask;
using Microsoft.SqlServer.Dts.Tasks.FileSystemTask;
namespace PrecedenceConst
{
class Program
{
static void Main(string[] args)
{
Package pkg = new Package();
// Add a File System task.
Executable eFileTask1 = pkg.Executables.Add("STOCK:FileSystemTask");
TaskHost thFileTask1 = eFileTask1 as TaskHost;
// Add a second File System task.
Executable eFileTask2 = pkg.Executables.Add("STOCK:FileSystemTask");
TaskHost thFileTask2 = eFileTask2 as TaskHost;
// Add a Bulk Insert task.
Executable eBulkInsert = pkg.Executables.Add("STOCK:BulkInsertTask");
TaskHost thBulkInsert = eBulkInsert as TaskHost;
// Add a precedence contraint between eFileTask1 and eFileTask2.
// Set the constraint to be that eFileTask2 cannot run
// until eFileTask1 completes.
PrecedenceConstraint pcFileTasks = pkg.PrecedenceConstraints.Add(eFileTask1, eFileTask2);
pcFileTasks.Name = "constraint between File System Tasks";
// Add another precedence contraint. Add it between eFileTask2 and BulkInsert.
// Again, set the constraint to be that BulkInsert cannot run
// until eFileTask2 completes.
PrecedenceConstraint pcFiletoBulk = pkg.PrecedenceConstraints.Add(eFileTask2, eBulkInsert);
pcFileTasks.Name = "constraint between File System and Bulk Insert Tasks";
// Obtain the precedence constraint collection.
PrecedenceConstraints pConsts = pkg.PrecedenceConstraints;
Boolean containsConstraint = pkg.PrecedenceConstraints.Contains("constraint between File System and Bulk Insert Tasks");
Console.WriteLine("Contains the constraint between File System and Bulk Insert Tasks? {0}", containsConstraint);
foreach (PrecedenceConstraint pc in pConsts)
{
Console.WriteLine("Constrained container {0}", pc.ConstrainedExecutable);
Console.WriteLine("Evaluation operation {0}", pc.EvalOp);
Console.WriteLine("Evaluates true {0}", pc.EvaluatesTrue);
Console.WriteLine("ID {0}", pc.ID);
Console.WriteLine("LogicalAnd {0}", pc.LogicalAnd);
Console.WriteLine("Precedence Executable {0}", pc.PrecedenceExecutable);
Console.WriteLine("-----------------------------------");
}
// Set the EvalOp of the first constraint using the DtsPrecedenceEvalOp enumerator.
PrecedenceConstraint firstPC = pConsts[0];
firstPC.EvalOp = DTSPrecedenceEvalOp.Expression;
Console.WriteLine("Evaluation operation after {0}", firstPC.EvalOp);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Imports Microsoft.SqlServer.Dts.Tasks.BulkInsertTask
Imports Microsoft.SqlServer.Dts.Tasks.FileSystemTask
Namespace PrecedenceConst
Class Program
Shared Sub Main(ByVal args() As String)
Dim pkg As Package = New Package()
' Add a File System task.
Dim eFileTask1 As Executable = pkg.Executables.Add("STOCK:FileSystemTask")
Dim thFileTask1 As TaskHost = eFileTask1 as TaskHost
' Add a second File System task.
Dim eFileTask2 As Executable = pkg.Executables.Add("STOCK:FileSystemTask")
Dim thFileTask2 As TaskHost = eFileTask2 as TaskHost
' Add a Bulk Insert task.
Dim eBulkInsert As Executable = pkg.Executables.Add("STOCK:BulkInsertTask")
Dim thBulkInsert As TaskHost = eBulkInsert as TaskHost
' Add a precedence contraint between eFileTask1 and eFileTask2.
' Set the constraint to be that eFileTask2 cannot run
' until eFileTask1 completes.
Dim pcFileTasks As PrecedenceConstraint = pkg.PrecedenceConstraints.Add(eFileTask1,eFileTask2)
pcFileTasks.Name = "constraint between File System Tasks"
' Add another precedence contraint. Add it between eFileTask2 and BulkInsert.
' Again, set the constraint to be that BulkInsert cannot run
' until eFileTask2 completes.
Dim pcFiletoBulk As PrecedenceConstraint = pkg.PrecedenceConstraints.Add(eFileTask2,eBulkInsert)
pcFileTasks.Name = "constraint between File System and Bulk Insert Tasks"
' Obtain the precedence constraint collection.
Dim pConsts As PrecedenceConstraints = pkg.PrecedenceConstraints
Dim containsConstraint As Boolean = pkg.PrecedenceConstraints.Contains("constraint between File System and Bulk Insert Tasks")
Console.WriteLine("Contains the constraint between File System and Bulk Insert Tasks? {0}", containsConstraint)
Dim pc As PrecedenceConstraint
For Each pc In pConsts
Console.WriteLine("Constrained container {0}", pc.ConstrainedExecutable)
Console.WriteLine("Evaluation operation {0}", pc.EvalOp)
Console.WriteLine("Evaluates true {0}", pc.EvaluatesTrue)
Console.WriteLine("ID {0}", pc.ID)
Console.WriteLine("LogicalAnd {0}", pc.LogicalAnd)
Console.WriteLine("Precedence Executable {0}", pc.PrecedenceExecutable)
Console.WriteLine("-----------------------------------")
Next
' Set the EvalOp of the first constraint using the DtsPrecedenceEvalOp enumerator.
Dim firstPC As PrecedenceConstraint = pConsts(0)
firstPC.EvalOp = DTSPrecedenceEvalOp.Expression
Console.WriteLine("Evaluation operation after {0}", firstPC.EvalOp)
End Sub
End Class
End Namespace
Sample Output:
Contains the constraint between File System and Bulk Insert Tasks? True
Constrained container Microsoft.SqlServer.Dts.Runtime.TaskHost
Evaluation operation Constraint
Evaluates true True
ID {0EDDD5B8-7135-4A73-B240-EDF54C0E66AC}
LogicalAnd True
Precedence Executable Microsoft.SqlServer.Dts.Runtime.TaskHost
-----------------------------------
Constrained container Microsoft.SqlServer.Dts.Runtime.TaskHost
Evaluation operation Constraint
Evaluates true True
ID {80584B94-A3D0-4E08-B9C1-8CCC7BD7D086}
LogicalAnd True
Precedence Executable Microsoft.SqlServer.Dts.Runtime.TaskHost
-----------------------------------
Evaluation operation after Expression