변경 내용을 항목에 적용하는 동안 발생한 복구할 수 있는 오류를 기록합니다.
네임스페이스: Microsoft.Synchronization.SimpleProviders
어셈블리: microsoft.synchronization.simpleproviders.dll의 Microsoft.Synchronization.SimpleProviders
구문
‘선언
Public Sub RecordRecoverableErrorForChange ( _
errorData As RecoverableErrorData _
)
‘사용 방법
Dim instance As RecoverableErrorReportingContext
Dim errorData As RecoverableErrorData
instance.RecordRecoverableErrorForChange(errorData)
public void RecordRecoverableErrorForChange (
RecoverableErrorData errorData
)
public:
void RecordRecoverableErrorForChange (
RecoverableErrorData^ errorData
)
public void RecordRecoverableErrorForChange (
RecoverableErrorData errorData
)
public function RecordRecoverableErrorForChange (
errorData : RecoverableErrorData
)
매개 변수
- errorData
보고된 복구할 수 있는 오류와 연결된 RecoverableErrorData 개체입니다.
예외
| 예외 형식 | 조건 |
|---|---|
여러 개의 복구할 수 있는 오류가 있었거나 더 이상 유효하지 않은 개체를 변경하려고 시도했습니다. |
예제
다음 코드 예제에서는 메모리 내 샘플 데이터 저장소에 삭제를 적용하는 DeleteItem 메서드의 구현을 보여 줍니다. 이 메서드는 삭제를 적용할 수 없는 경우 복구할 수 있는 오류를 기록합니다. 전체 응용 프로그램의 맥락에서 이 코드를 보려면 Sync Framework SDK 및 Code Gallery에서 사용할 수 있는 "Sync101 using Simple Sync Provider" 응용 프로그램을 참조하십시오.
public override void DeleteItem(ItemFieldDictionary keyAndExpectedVersion,
RecoverableErrorReportingContext recoverableErrorReportingContext,
out bool commitKnowledgeAfterThisItem)
{
IDictionary<uint, ItemField> expectedFields = (IDictionary<uint, ItemField>)keyAndExpectedVersion;
ulong id = (ulong)expectedFields[CUSTOM_FIELD_ID].Value;
if (_store.Contains(id))
{
_store.DeleteItem(id);
}
else
{
// If the item to delete does not exist, record an error on this change and
// continue with the rest of the session.
recoverableErrorReportingContext.RecordRecoverableErrorForChange(new RecoverableErrorData(new Exception("Item not found in the store")));
}
commitKnowledgeAfterThisItem = false;
}
Public Overrides Sub DeleteItem(ByVal keyAndExpectedVersion As ItemFieldDictionary, ByVal recoverableErrorReportingContext As RecoverableErrorReportingContext, ByRef commitKnowledgeAfterThisItem As Boolean)
Dim expectedFields As IDictionary(Of UInteger, ItemField) = DirectCast(keyAndExpectedVersion, IDictionary(Of UInteger, ItemField))
Dim id As ULong = CULng(expectedFields(CUSTOM_FIELD_ID).Value)
If _store.Contains(id) Then
_store.DeleteItem(id)
Else
' If the item to delete does not exist, record an error on this change and
' continue with the rest of the session.
recoverableErrorReportingContext.RecordRecoverableErrorForChange(New RecoverableErrorData(New Exception("Item not found in the store")))
End If
commitKnowledgeAfterThisItem = False
End Sub
참고 항목
참조
RecoverableErrorReportingContext 클래스
RecoverableErrorReportingContext 멤버
Microsoft.Synchronization.SimpleProviders 네임스페이스