SendMailTask.InitializeTask Método

Definición

Inicializa las propiedades asociadas a la tarea. El motor en tiempo de ejecución llama a este método, que no se usa en el código.

public:
 override void InitializeTask(Microsoft::SqlServer::Dts::Runtime::Connections ^ connections, Microsoft::SqlServer::Dts::Runtime::VariableDispenser ^ variableDispenser, Microsoft::SqlServer::Dts::Runtime::IDTSInfoEvents ^ events, Microsoft::SqlServer::Dts::Runtime::IDTSLogging ^ log, Microsoft::SqlServer::Dts::Runtime::EventInfos ^ eventInfos, Microsoft::SqlServer::Dts::Runtime::LogEntryInfos ^ logEntryInfos, Microsoft::SqlServer::Dts::Runtime::ObjectReferenceTracker ^ refTracker);
public override void InitializeTask (Microsoft.SqlServer.Dts.Runtime.Connections connections, Microsoft.SqlServer.Dts.Runtime.VariableDispenser variableDispenser, Microsoft.SqlServer.Dts.Runtime.IDTSInfoEvents events, Microsoft.SqlServer.Dts.Runtime.IDTSLogging log, Microsoft.SqlServer.Dts.Runtime.EventInfos eventInfos, Microsoft.SqlServer.Dts.Runtime.LogEntryInfos logEntryInfos, Microsoft.SqlServer.Dts.Runtime.ObjectReferenceTracker refTracker);
override this.InitializeTask : Microsoft.SqlServer.Dts.Runtime.Connections * Microsoft.SqlServer.Dts.Runtime.VariableDispenser * Microsoft.SqlServer.Dts.Runtime.IDTSInfoEvents * Microsoft.SqlServer.Dts.Runtime.IDTSLogging * Microsoft.SqlServer.Dts.Runtime.EventInfos * Microsoft.SqlServer.Dts.Runtime.LogEntryInfos * Microsoft.SqlServer.Dts.Runtime.ObjectReferenceTracker -> unit
Public Overrides Sub InitializeTask (connections As Connections, variableDispenser As VariableDispenser, events As IDTSInfoEvents, log As IDTSLogging, eventInfos As EventInfos, logEntryInfos As LogEntryInfos, refTracker As ObjectReferenceTracker)

Parámetros

connections
Connections

Una colección de conexiones utilizadas por la tarea.

variableDispenser
VariableDispenser

Objeto P:Microsoft.SqlServer.Dts.Runtime.DtsContainer.VariableDispenser para bloquear variables.

events
IDTSInfoEvents

Objeto que implementa la interfaz T:Microsoft.SqlServer.Dts.Runtime.IDTSInfoEvents.

log
IDTSLogging

Objeto que implementa la interfaz T:Microsoft.SqlServer.Dts.Runtime.IDTSLogging.

eventInfos
EventInfos

Una colección que contiene eventos que se van a generar durante la ejecución de la tarea.

logEntryInfos
LogEntryInfos

Una colección de entradas de registro.

refTracker
ObjectReferenceTracker

Un rastreador de referencias de objetos.

Ejemplos

Los desarrolladores de tareas definen eventos personalizados reemplazando el InitializeTask método de la Task clase base y creando un nuevo EventInfo. En el ejemplo de código siguiente se muestra el método InitializeTask de una tarea personalizada, donde se crean dos eventos personalizados y se agregan a la colección eventInfos.

public override void InitializeTask(Connections connections, VariableDispenser variables, IDTSInfoEvents events, IDTSLogging log, EventInfos eventInfos, LogEntryInfos logEntryInfos, ObjectReferenceTracker refTracker)  
{  
    this.eventInfos = eventInfos;  
    string[] paramNames = new string[1];  
    TypeCode[] paramTypes = new TypeCode[1]{TypeCode.Int32};  
    string[] paramDescriptions = new string[1];  

    paramNames[0] = "InitialValue";  
    paramDescriptions[0] = "The value before increment.";  

    this.eventInfos.Add("OnBeforeIncrement","Fires before the task increments the value.",true,paramNames,paramTypes,paramDescriptions);  
    this.onBeforeIncrement = this.eventInfos["OnBeforeIncrement"];  

    paramDescriptions[0] = "The value after increment.";  
    this.eventInfos.Add("OnAfterIncrement","Fires after the initial value is updated.",true,paramNames, paramTypes,paramDescriptions);  
    this.onAfterIncrement = this.eventInfos["OnAfterIncrement"];  
}  

Comentarios

Para las SendMailTask demás tareas de stock, este método se usa para establecer los eventos de registro de cada tarea.

El tiempo de ejecución de SSIS llama InitializeTask inmediatamente después de crear la tarea, antes de las operaciones de validación, ejecución o persistencia.

Se aplica a