Linguaggio

ScriptTask.SuspendRequired Proprietà

Definizione

Ottiene o imposta un Booleano che indica se un compito debba sospendere l'esecuzione quando il compito incontra un punto di interruzione. Questo valore viene stabilito dal motore di esecuzione per task e container quando si incontra un punto di interruzione.

public:
 property bool SuspendRequired { bool get(); void set(bool value); };
public bool SuspendRequired { get; set; }
member this.SuspendRequired : bool with get, set
Public Property SuspendRequired As Boolean

Valore della proprietà

vero se il compito sospende l'esecuzione quando incontra un punto di interruzione; altrimenti, falso.

Implementazioni

Esempio

Il seguente esempio di codice mostra come sovrascrivere la SuspendRequired proprietà per un compito personalizzato.

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

    set  
    {  
    // This lock is also taken by Suspend().  Because it is possible for the package to be   
    // suspended and resumed in quick succession, this property "set" 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 a 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().  Because 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 (Me)  
         {  
               Interlocked.Exchange(m_suspendRequired, value ? 1 : 0)   
                     If Not value Then  
                       ResumeExecution()  
                     End If  
             }  
         End Set  
End Property  

Commenti

Questa proprietà non è impostata nel codice. La proprietà è impostata dal runtime per task e container quando si incontra un punto di interruzione.

Tuttavia, se scrivi un task personalizzato multithread che espone i punti di interruzione, devi fornire codice per questo metodo, che viene ereditato dalla IDTSSuspend classe per oggetti multithread. Se il tuo compito è a singolo thread, il che significa che l'implementazione di Execute nel tuo task personalizzato non avvia nuovi thread, non devi implementare questa interfaccia. Per maggiori informazioni sulla scrittura di compiti personalizzati, vedi Sviluppo di un compito personalizzato.

Si applica a