Share via


SuspendRequired プロパティ

ブレークポイントに到達したときにタスクを中断するかどうかを示す Boolean を取得します。値の設定も可能です。この値は、ブレークポイントに到達したときにタスクおよびコンテナに対してランタイム エンジンで設定されます。

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

構文

'宣言
Property SuspendRequired As Boolean
    Get
    Set
'使用
Dim instance As IDTSSuspend
Dim value As Boolean

value = instance.SuspendRequired

instance.SuspendRequired = value
bool SuspendRequired { get; set; }
property bool SuspendRequired {
    bool get ();
    void set (bool value);
}
abstract SuspendRequired : bool with get, set
function get SuspendRequired () : boolean
function set SuspendRequired (value : boolean)

プロパティ値

型: System. . :: . .Boolean
ブレークポイントに到達したときにタスクを中断する場合は true です。

説明

プロパティはコード内では設定されません。ブレークポイントに到達したときにタスクおよびコンテナに対してランタイムで設定されます。

ただし、ブレークポイントを公開するマルチスレッド カスタム タスクを作成する場合は、IDTSSuspend クラスから継承されるこのメソッドのコードを指定する必要があります。タスクがシングル スレッドであり、カスタム タスクで Execute を実装しても新しいスレッドが起動されない場合は、このインターフェイスを実装する必要はありません。カスタム タスクの作成の詳細については、「カスタム タスクの開発」を参照してください。

使用例

次のコードは、カスタム タスクのオーバーライドされた SuspendRequired プロパティの例です。

public bool SuspendRequired 
{
     get
    { 
        // m_suspendRequired is an Private integer declared in the custom task. 
        return m_suspendRequired != 0; 
    }

    set
    {
    // This lock is also taken by Suspend().  Since it is possible for the package to be 
    // suspended and resumed in quick succession, this property "put" might happen 
    // before the actual Suspend() call.  Without the lock, the Suspend() might reset 
    // the canExecute event after we set it to abort the suspension. 
         lock (this) 
    {
        Interlocked.Exchange(ref m_suspendRequired, value ? 1 : 0); 
            if (!value) 
                ResumeExecution(); 
    }
}
Public ReadOnly Property SuspendRequired() As Boolean
    Get 
        ' m_suspendRequired is an Private integer declared in the custom task. 
        Return m_suspendRequired <> 0
     End Get

Public WriteOnly Property SuspendRequired() As Boolean
    Set (ByVal Value As Boolean) 
        ' This lock is also taken by Suspend().  Since it is possible for the package to be 
        ' suspended and resumed in quick succession, this property "put" might happen 
       ' before the actual Suspend() call.  Without the lock, the Suspend() might reset
       ' the canExecute event after it is set to abort the suspension. 
         lock (Me)
         {
               Interlocked.Exchange(m_suspendRequired, value ? 1 : 0) 
                     If Not value Then
                       ResumeExecution()
                     End If
             }
         End Set
End Property