Condividi tramite


IDTSSuspend.SuspendRequired Property

Gets or sets a Boolean that indicates if tasks should suspend when they encounter a breakpoint. This value is set by the runtime engine for tasks and containers when a breakpoint is encountered.

Spazio dei nomi: Microsoft.SqlServer.Dts.Runtime
Assembly : Microsoft.SqlServer.ManagedDTS (in microsoft.sqlserver.manageddts.dll)

Sintassi

'Dichiarazione
Property SuspendRequired As Boolean
bool SuspendRequired { get; set; }
property bool SuspendRequired {
    bool get ();
    void set (bool value);
}
/** @property */
boolean get_SuspendRequired ()

/** @property */
void set_SuspendRequired (boolean value)
function get SuspendRequired () : boolean

function set SuspendRequired (value : boolean)

Valore proprietà

true if the task suspends when it encounters a breakpoint.

Osservazioni

The property is not set in code. It is set by the runtime for tasks and containers when a breakpoint is encountered.

However, you will need to provide code for this method, which is inherited from the IDTSSuspend class, if you write a multi-threaded custom task that exposes breakpoints. If your task is single threaded, which means that your implementation of Execute in your custom task does not start new threads, you do not need to implement this interface. For more information on writing custom tasks, see Developing a Custom Task.

Esempio

The following code example is an example of an overridden SuspendRequired property for a custom task.

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

Thread Safety

Any public static (Shared in Microsoft Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Piattaforme

Piattaforme di sviluppo

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Piattaforme di destinazione

Per un elenco delle piattaforme supportate, vedere Requisiti hardware e software per l'Installazione di SQL Server 2005.

Vedere anche

Riferimento

IDTSSuspend Interface
IDTSSuspend Members
Microsoft.SqlServer.Dts.Runtime Namespace