protected void Abort() { foreach (object persistenceParticipant in persistenceParticipants) { System.Activities.Persistence.PersistenceParticipant legacyPersistenceParticipant = persistenceParticipant as System.Activities.Persistence.PersistenceParticipant; if (legacyPersistenceParticipant != null && legacyPersistenceParticipant.IsIOParticipant()) { (legacyPersistenceParticipant as System.Activities.Persistence.PersistenceIOParticipant).Abort(); } else { (persistenceParticipant as IPersistenceIOParticipant)?.Abort(); } } }
// TODO Handle timeout correctly, ie. decrement remaining time in each for loop. public async Task OnLoadAsync(TimeSpan timeout) { try { foreach (object persistenceParticipant in persistenceParticipants) { System.Activities.Persistence.PersistenceParticipant legacyPersistenceParticipant = persistenceParticipant as System.Activities.Persistence.PersistenceParticipant; if (legacyPersistenceParticipant != null && legacyPersistenceParticipant.IsIOParticipant()) { await(legacyPersistenceParticipant as System.Activities.Persistence.PersistenceIOParticipant).OnLoadAsync(readWriteView, timeout); } else { await((persistenceParticipant as IPersistenceIOParticipant)?.OnLoadAsync(readWriteView, timeout) ?? TaskConstants.Completed); } } } catch { Abort(); // TODO Original pipeline seems to drop this to the floor, but the reference source is insufficient. throw; } }