FailureProcessingResult IFailuresPreprocessor.PreprocessFailures(FailuresAccessor failuresAccessor) { if (!failuresAccessor.IsTransactionBeingCommitted()) { return(FailureProcessingResult.Continue); } if (failuresAccessor.GetSeverity() >= FailureSeverity.DocumentCorruption) { return(FailureProcessingResult.ProceedWithRollBack); } if (failuresAccessor.GetSeverity() >= FailureSeverity.Error) { // Handled failures in order { var failureDefinitionIdsToFix = FailureDefinitionIdsToFix; if (failureDefinitionIdsToFix != null) { var result = FixFailures(failuresAccessor, failureDefinitionIdsToFix); if (result != FailureProcessingResult.Continue) { return(result); } } } // Unhandled failures in incomming order { var failureDefinitionIdsToFix = failuresAccessor.GetFailureMessages().GroupBy(x => x.GetFailureDefinitionId()).Select(x => x.Key); var result = FixFailures(failuresAccessor, failureDefinitionIdsToFix); if (result != FailureProcessingResult.Continue) { return(result); } } } if (failuresAccessor.GetSeverity() >= FailureSeverity.Warning) { // Unsolved failures or warnings foreach (var error in failuresAccessor.GetFailureMessages().OrderBy(error => error.GetSeverity())) { AddRuntimeMessage(error, false); } failuresAccessor.DeleteAllWarnings(); } return(FailureProcessingResult.Continue); }