Package.PrecedenceConstraints 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取 PrecedenceConstraint 对象的集合。 此字段为只读。
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
属性值
PrecedenceConstraint 对象的集合。
实现
示例
下面的代码示例将两个任务添加到包中,并在它们之间放置优先约束。 然后,它会计算包集合中的约束数。
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.SqlServer.Dts.Runtime;
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
// unless thFileTask1 completes.
PrecedenceConstraint pcFileTasks = p.PrecedenceConstraints.Add((Executable)thFileHost1, (Executable) thFileHost2);
pcFileTasks.Value = DTSExecResult.Completion;
// Return and show the count of precedence constraints in the package.
PrecedenceConstraints pCons = p.PrecedenceConstraints;
Console.WriteLine("Precedence constraints in package = {0}", pCons.Count);
}
}
}
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Microsoft.SqlServer.Dts.Runtime
Namespace Package_API
Class Program
Shared Sub Main(ByVal args() As String)
Dim app As Application = New Application()
Dim pkg As Package = New Package()
pkg = app.LoadPackage("C:\Program Files\Microsoft SQL Server\100\Samples\Integration Services\Package Samples\CalculatedColumns Sample\CalculatedColumns\CalculatedColumns.dtsx", Nothing)
' Show the package type
Console.WriteLine("The package type is {0}", pkg.PackageType)
End Sub
End Class
End Namespace
示例输出:
Precedence constraints in package = 1
注解
返回对象集合 PrecedenceConstraint ,这些对象包含有关执行步骤之前必须发生的条件的信息。 有关优先约束的详细信息,请参阅 优先约束。