Hinweis
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, sich anzumelden oder das Verzeichnis zu wechseln.
Für den Zugriff auf diese Seite ist eine Autorisierung erforderlich. Sie können versuchen, das Verzeichnis zu wechseln.
Zeichnet einen behebbaren Fehler auf, der beim Versuch aufgetreten ist, eine Änderung für ein Element zu übernehmen.
Namespace: Microsoft.Synchronization.SimpleProviders
Assembly: Microsoft.Synchronization.SimpleProviders (in microsoft.synchronization.simpleproviders.dll)
Syntax
'Declaration
Public Sub RecordRecoverableErrorForChange ( _
errorData As RecoverableErrorData _
)
'Usage
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
)
Parameter
- errorData
Das RecoverableErrorData-Objekt, das dem behebbaren Fehler zugeordnet ist, der gemeldet wird.
Ausnahmen
| Ausnahmetyp | Bedingung |
|---|---|
Es sind mehrere behebbare Fehler aufgetreten, oder es wurde versucht, eine Änderung für ein Objekt zu übernehmen, das nicht mehr gültig ist. |
Beispiel
Im folgenden Codebeispiel wird eine Implementierung der DeleteItem-Methode gezeigt, die Löschungen auf einen Beispieldatenspeicher im Arbeitsspeicher anwendet. Die Methode zeichnet einen behebbaren Fehler auf, wenn die Löschung nicht angewendet werden kann. In der "Sync101 using Simple Sync Provider"-Anwendung, die im Sync Framework SDK und in der Code Gallery verfügbar ist, finden Sie diesen Code im Kontext einer vollständigen Anwendung.
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
Siehe auch
Verweis
RecoverableErrorReportingContext-Klasse
RecoverableErrorReportingContext-Member
Microsoft.Synchronization.SimpleProviders-Namespace