次の方法で共有


Package.PrecedenceConstraints プロパティ

PrecedenceConstraint オブジェクトのコレクションを取得します。 このフィールドは読み取り専用です。

名前空間:  Microsoft.SqlServer.Dts.Runtime
アセンブリ:  Microsoft.SqlServer.ManagedDTS (Microsoft.SqlServer.ManagedDTS.dll)

構文

'宣言
Public ReadOnly Property PrecedenceConstraints As PrecedenceConstraints 
    Get
'使用
Dim instance As Package 
Dim value As PrecedenceConstraints 

value = instance.PrecedenceConstraints
public PrecedenceConstraints PrecedenceConstraints { get; }
public:
virtual property PrecedenceConstraints^ PrecedenceConstraints {
    PrecedenceConstraints^ get () sealed;
}
abstract PrecedenceConstraints : PrecedenceConstraints 
override PrecedenceConstraints : PrecedenceConstraints
final function get PrecedenceConstraints () : PrecedenceConstraints

プロパティ値

型: Microsoft.SqlServer.Dts.Runtime.PrecedenceConstraints
PrecedenceConstraint オブジェクトのコレクションです。

実装

IDTSSequence.PrecedenceConstraints

説明

手順が実行される前に必要な条件についての情報を含む PrecedenceConstraint オブジェクトのコレクションを返します。 優先順位制約の詳細については、「優先順位制約」を参照してください。

使用例

次のコード例では、パッケージに 2 つのタスクを追加し、これらの間に優先順位制約を配置します。 さらに、パッケージ コレクションの制約の数をカウントします。

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

関連項目

参照

Package クラス

Microsoft.SqlServer.Dts.Runtime 名前空間