DbApplyChangeFailedEventArgs.Error プロパティ
同期中に発生した例外に関するメタデータを格納する Exception オブジェクトを取得します。
名前空間: Microsoft.Synchronization.Data
アセンブリ: Microsoft.Synchronization.Data (microsoft.synchronization.data.dll 内)
構文
'宣言
Public ReadOnly Property Error As Exception
'使用
Dim instance As DbApplyChangeFailedEventArgs
Dim value As Exception
value = instance.Error
public Exception Error { get; }
public:
property Exception^ Error {
Exception^ get ();
}
/** @property */
public Exception get_Error ()
public function get Error () : Exception
プロパティ値
同期中に発生した例外に関するメタデータを格納する Exception オブジェクト。
例
次のコード例では、エラー情報をログ ファイルに書き込みます。
else if (e.Conflict.Type == DbConflictType.ErrorsOccurred)
{
string logFile = @"C:\SyncErrorLog.txt";
Console.WriteLine(String.Empty);
Console.WriteLine("An error occurred during synchronization.");
Console.WriteLine("This error has been logged to " + logFile + ".");
StreamWriter streamWriter = File.AppendText(logFile);
StringBuilder outputText = new StringBuilder();
outputText.AppendLine("** APPLY CHANGE FAILURE AT " + DbConflictDetected.ToUpper() + " **");
outputText.AppendLine("Error source: " + e.Error.Source);
outputText.AppendLine("Error message: " + e.Error.Message);
streamWriter.WriteLine(DateTime.Now.ToShortTimeString() + " | " + outputText.ToString());
streamWriter.Flush();
streamWriter.Dispose();
}
ElseIf e.Conflict.Type = DbConflictType.ErrorsOccurred Then
Dim logFile As String = "C:\SyncErrorLog.txt"
Console.WriteLine(String.Empty)
Console.WriteLine("An error occurred during synchronization.")
Console.WriteLine("This error has been logged to " & logFile & ".")
Dim streamWriter As StreamWriter = File.AppendText(logFile)
Dim outputText As New StringBuilder()
outputText.AppendLine("** APPLY CHANGE FAILURE AT " & DbConflictDetected.ToUpper() & " **")
outputText.AppendLine("Error source: " & e.Error.Source)
outputText.AppendLine("Error message: " & e.Error.Message)
streamWriter.WriteLine(DateTime.Now.ToShortTimeString() & " | " & outputText.ToString())
streamWriter.Flush()
streamWriter.Dispose()
End If
参照
リファレンス
DbApplyChangeFailedEventArgs クラス
DbApplyChangeFailedEventArgs メンバー
Microsoft.Synchronization.Data 名前空間