- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I want to see if a warning is going to be presented to user to say hey, dont delete that view as it will delete view x,y,z as well. I used something similar to this to prevent walls being created with errors, however is there something more staightforward or do i need to get some boolean flag return from a call to the below. it doesnt seem to work as i have to try to delete an object before it rolls back the error.
private static void SendTransactionToSwallower(Transaction transSwallow)
{
FailureHandlingOptions failOpt = transSwallow.GetFailureHandlingOptions();
failOpt.SetFailuresPreprocessor(new WarningRollback());
failOpt.SetClearAfterRollback(true);
transSwallow.SetFailureHandlingOptions(failOpt);
}
class WarningRollback : IFailuresPreprocessor
{
FailureProcessingResult IFailuresPreprocessor.PreprocessFailures(FailuresAccessor a)
{
IList<FailureMessageAccessor> failures = a.GetFailureMessages();
foreach (FailureMessageAccessor f in failures)
{
FailureSeverity fseverity = a.GetSeverity();
a.ResolveFailure(f);
return FailureProcessingResult.ProceedWithRollBack;
}
return FailureProcessingResult.Continue;
}
}
Solved! Go to Solution.