表示當這個變更單位的資料已儲存至項目存放區時所發生的可復原錯誤。
命名空間: Microsoft.Synchronization
組件: Microsoft.Synchronization (在 microsoft.synchronization.dll)
語法
'宣告
Public Sub RecordRecoverableErrorForChangeUnit ( _
changeUnitChange As ChangeUnitChange, _
errorData As RecoverableErrorData _
)
'用途
Dim instance As SaveChangeWithChangeUnitsContext
Dim changeUnitChange As ChangeUnitChange
Dim errorData As RecoverableErrorData
instance.RecordRecoverableErrorForChangeUnit(changeUnitChange, errorData)
public void RecordRecoverableErrorForChangeUnit (
ChangeUnitChange changeUnitChange,
RecoverableErrorData errorData
)
public:
void RecordRecoverableErrorForChangeUnit (
ChangeUnitChange^ changeUnitChange,
RecoverableErrorData^ errorData
)
public void RecordRecoverableErrorForChangeUnit (
ChangeUnitChange changeUnitChange,
RecoverableErrorData errorData
)
public function RecordRecoverableErrorForChangeUnit (
changeUnitChange : ChangeUnitChange,
errorData : RecoverableErrorData
)
參數
- changeUnitChange
導致錯誤的變更單位變更。
- errorData
有關錯誤的其他資訊。
例外
| 例外狀況型別 | 條件 |
|---|---|
包含在 SaveChangeWithChangeUnitsContext 物件中的儲存動作是 Create。在這種情況下,建立整個項目必定會失敗。 |
備註
呼叫這個方法時,ItemChangeUnitOverride 物件就會加入至學習到的知識,而且不會在同步處理工作階段的持續期間再次列舉變更單位變更。
範例
下列範例會嘗試建立或更新目的地複寫中的變更單位。發生例外狀況時,系統就會針對變更單位記錄包含例外狀況的可復原錯誤,而且同步處理會繼續進行。
Case SaveChangeAction.Create, SaveChangeAction.UpdateVersionAndData
If True Then
' Update the item store and metadata store for the specified change unit.
Try
Dim cuData As String = DirectCast(context.ChangeData, String())(cuChange.ChangeUnitId.GetByteId())
_ContactStore.UpdateContactFromSync(change, cuChange, cuData)
Catch ex As Exception
Dim errData As New RecoverableErrorData(ex)
context.RecordRecoverableErrorForChangeUnit(cuChange, errData)
End Try
Exit Select
End If
case SaveChangeAction.Create:
case SaveChangeAction.UpdateVersionAndData:
{
// Update the item store and metadata store for the specified change unit.
try
{
string cuData = ((string[])context.ChangeData)[cuChange.ChangeUnitId.GetByteId()];
_ContactStore.UpdateContactFromSync(change, cuChange, cuData);
}
catch (Exception ex)
{
RecoverableErrorData errData = new RecoverableErrorData(ex);
context.RecordRecoverableErrorForChangeUnit(cuChange, errData);
}
break;
}
請參閱
參考
SaveChangeWithChangeUnitsContext 類別
SaveChangeWithChangeUnitsContext 成員
Microsoft.Synchronization 命名空間