LogProviderBase.OpenLog メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
パッケージ実行開始時に呼び出され、外部データソースとの接続を確立します。
public:
virtual void OpenLog();
public virtual void OpenLog();
abstract member OpenLog : unit -> unit
override this.OpenLog : unit -> unit
Public Overridable Sub OpenLog ()
例
以下の例は、ConfigStringプロパティで指定されたConnectionManagerを使って外部テキストファイルに接続する方法を示しています。 接続変数は
public override void OpenLog()
{
// Get the ConnectionManager from the package's
// Connections collection.
connectionManager cm = connections[ConfigString];
// AcquireConnection for a file ConnectionManager
// retrieves the path to the file.
string path = (string)cm.AcquireConnection(null);
// Instantiate the stream writer, and writes the opening
// log entry.
this.sw = new StreamWriter(path);
sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString());
}
Public Overrides Sub OpenLog()
' Get the ConnectionManager from the package's
' Connections collection.
Dim cm As connectionManager = connections(ConfigString)
' AcquireConnection for a file ConnectionManager
' retrieves the path to the file.
Dim path As String = CType(cm.AcquireConnection(Nothing), String)
' Instantiate the stream writer, and writes the opening
' log entry.
Me.sw = New StreamWriter(path)
sw.WriteLine("OpenLog: " + DateTime.Now.ToShortDateString())
End Sub
注釈
このメソッドはパッケージ実行開始時および実行イベントが発生する前に呼び出されます。 この方法を使って外部データソースとの接続を確立し、 Log メソッドへの呼び出しに対応する準備をしましょう。