WmiDataReaderTask.SuspendRequired Proprietà

Definizione

Ottiene o imposta un Booleano che indica se i compiti devono sospendere quando incontrano un punto di interruzione. Questo valore viene impostato dal motore di esecuzione per compiti 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 si sospende quando incontra un punto di interruzione.

Implementazioni

Esempio

Il seguente esempio di codice è un esempio di proprietà sovrascritta SuspendRequired per un compito personalizzato.

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  

Commenti

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

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

Si applica a