XMLTask.SuspendRequired Proprietà

Definizione

Ottiene o imposta un valore booleano che indica se le attività devono essere sospese quando viene rilevato un punto di interruzione. Questo valore viene impostato dal motore di runtime per le attività e i contenitori quando viene rilevato 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à

Boolean

true se l'attività viene sospesa.

Implementazioni

Esempio

L'esempio di codice seguente è un esempio di proprietà sottoposta a override SuspendRequired per un'attività personalizzata.

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 le attività e i contenitori quando viene rilevato un punto di interruzione.

Tuttavia, sarà necessario fornire il codice per questo metodo, che viene ereditato dalla IDTSSuspend classe, se si scrive un'attività personalizzata multithread che espone punti di interruzione. Se l'attività è a thread singolo, il che significa che l'implementazione di Execute nell'attività personalizzata non avvia nuovi thread, non è necessario implementare questa interfaccia. Per ulteriori informazioni sulla scrittura di attività personalizzate, vedere sviluppo di un'attività personalizzata.

Si applica a