public bool FlushBookmarkScopeKeys(ActivityExecutor executor) { Fx.Assert(executor.BookmarkScopeManager.HasKeysToUpdate, "We should not have been called if we don't have pending keys."); try { // disassociation is local-only so we don't need to yield ICollection <InstanceKey> keysToDisassociate = executor.BookmarkScopeManager.GetKeysToDisassociate(); if (keysToDisassociate != null && keysToDisassociate.Count > 0) { executor.DisassociateKeys(keysToDisassociate); } // if we have keys to associate, provide them for an asynchronous association ICollection <InstanceKey> keysToAssociate = executor.BookmarkScopeManager.GetKeysToAssociate(); // It could be that we only had keys to Disassociate. We should only do BeginAssociateKeys // if we have keysToAssociate. if (keysToAssociate != null && keysToAssociate.Count > 0) { if (s_associateCallback == null) { s_associateCallback = Fx.ThunkCallback(new AsyncCallback(OnAssociateComplete)); } IAsyncResult result = executor.BeginAssociateKeys(keysToAssociate, s_associateCallback, new CallbackData(executor, this)); if (result.CompletedSynchronously) { executor.EndAssociateKeys(result); } else { return(false); } } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } this.workflowAbortException = e; } return(true); }
public bool FlushBookmarkScopeKeys(ActivityExecutor executor) { try { ICollection <InstanceKey> keysToDisassociate = executor.BookmarkScopeManager.GetKeysToDisassociate(); if ((keysToDisassociate != null) && (keysToDisassociate.Count > 0)) { executor.DisassociateKeys(keysToDisassociate); } ICollection <InstanceKey> keysToAssociate = executor.BookmarkScopeManager.GetKeysToAssociate(); if ((keysToAssociate != null) && (keysToAssociate.Count > 0)) { if (associateCallback == null) { associateCallback = Fx.ThunkCallback(new AsyncCallback(System.Activities.Runtime.WorkItem.OnAssociateComplete)); } IAsyncResult result = executor.BeginAssociateKeys(keysToAssociate, associateCallback, new CallbackData(executor, this)); if (result.CompletedSynchronously) { executor.EndAssociateKeys(result); } else { return(false); } } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.workflowAbortException = exception; } return(true); }
public bool FlushBookmarkScopeKeys(ActivityExecutor executor) { try { ICollection<InstanceKey> keysToDisassociate = executor.BookmarkScopeManager.GetKeysToDisassociate(); if ((keysToDisassociate != null) && (keysToDisassociate.Count > 0)) { executor.DisassociateKeys(keysToDisassociate); } ICollection<InstanceKey> keysToAssociate = executor.BookmarkScopeManager.GetKeysToAssociate(); if ((keysToAssociate != null) && (keysToAssociate.Count > 0)) { if (associateCallback == null) { associateCallback = Fx.ThunkCallback(new AsyncCallback(System.Activities.Runtime.WorkItem.OnAssociateComplete)); } IAsyncResult result = executor.BeginAssociateKeys(keysToAssociate, associateCallback, new CallbackData(executor, this)); if (result.CompletedSynchronously) { executor.EndAssociateKeys(result); } else { return false; } } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } this.workflowAbortException = exception; } return true; }
public bool FlushBookmarkScopeKeys(ActivityExecutor executor) { Fx.Assert(executor.BookmarkScopeManager.HasKeysToUpdate, "We should not have been called if we don't have pending keys."); try { // disassociation is local-only so we don't need to yield ICollection<InstanceKey> keysToDisassociate = executor.BookmarkScopeManager.GetKeysToDisassociate(); if (keysToDisassociate != null && keysToDisassociate.Count > 0) { executor.DisassociateKeys(keysToDisassociate); } // if we have keys to associate, provide them for an asynchronous association ICollection<InstanceKey> keysToAssociate = executor.BookmarkScopeManager.GetKeysToAssociate(); // It could be that we only had keys to Disassociate. We should only do BeginAssociateKeys // if we have keysToAssociate. if (keysToAssociate != null && keysToAssociate.Count > 0) { if (associateCallback == null) { associateCallback = Fx.ThunkCallback(new AsyncCallback(OnAssociateComplete)); } IAsyncResult result = executor.BeginAssociateKeys(keysToAssociate, associateCallback, new CallbackData(executor, this)); if (result.CompletedSynchronously) { executor.EndAssociateKeys(result); } else { return false; } } } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } this.workflowAbortException = e; } return true; }