Task.InitializeTask メソッド

定義

タスクに関連付けられたプロパティを初期化します。 このメソッドはランタイムから呼び出されるメソッドであり、コードでは使用されません。

public:
 virtual 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 virtual 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);
abstract member 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
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 Overridable Sub InitializeTask (connections As Connections, variableDispenser As VariableDispenser, events As IDTSInfoEvents, log As IDTSLogging, eventInfos As EventInfos, logEntryInfos As LogEntryInfos, refTracker As ObjectReferenceTracker)

パラメーター

connections
Connections

タスクで使用される接続のコレクションです。

variableDispenser
VariableDispenser

変数をロックするための VariableDispenser オブジェクトです。

events
IDTSInfoEvents

IDTSInfoEvents インターフェイスを実装するオブジェクト。

log
IDTSLogging

IDTSLogging インターフェイスを実装するオブジェクト。

eventInfos
EventInfos

タスクの実行中に発生させるイベントを含むコレクションです。

logEntryInfos
LogEntryInfos

ログ エントリのコレクションです。

refTracker
ObjectReferenceTracker

オブジェクト参照トラッカーです。

タスク開発者は、InitializeTask 基本クラスの Task メソッドをオーバーライドし、EventInfo を新規作成して、カスタム イベントを定義します。 次のコード サンプルは、カスタム タスクの InitializeTask メソッドを示しています。このメソッドでは、2 つのカスタム イベントが作成されて、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"];  
}  
Public Overrides Sub InitializeTask(ByVal connections As Connections,  ByVal variables As VariableDispenser, ByVal events As IDTSInfoEvents, ByVal log As IDTSLogging, ByVal eventInfos As EventInfos, ByVal logEntryInfos As LogEntryInfos, ByVal refTracker As ObjectReferenceTracker)   
    Me.eventInfos = eventInfos  
    Dim paramNames(0) As String  
    Dim paramTypes(0) As TypeCode = {TypeCode.Int32}  
    Dim paramDescriptions(0) As String  

    paramNames(0) = "InitialValue"  
    paramDescriptions(0) = "The value before increment."  

    Me.eventInfos.Add("OnBeforeIncrement", "Fires before the task increments the value.", True, paramNames, paramTypes, paramDescriptions)  
    Me.onBeforeIncrement = Me.eventInfos("OnBeforeIncrement")  

    paramDescriptions(0) = "The value after increment."  
    Me.eventInfos.Add("OnAfterIncrement", "Fires after the initial value is updated.", True, paramNames, paramTypes, paramDescriptions)  
    Me.onAfterIncrement = Me.eventInfos("OnAfterIncrement")  
End Sub  

注釈

ストック タスクの場合、このメソッドを使用して各タスクのログ イベントを設定します。

実行時エンジンは、検証、実行、または永続化の操作の前に、タスクが作成された直後に呼び出されます InitializeTask

適用対象