コード例 #1
0
 private static void Finally(AsyncResult result, Exception completionException)
 {
     ControlOperationInvoker.ControlOperationAsyncResult result2 = (ControlOperationInvoker.ControlOperationAsyncResult)result;
     if (result2.workflowServiceInstance != null)
     {
         result2.workflowServiceInstance.ReleaseReference();
         result2.workflowServiceInstance = null;
     }
     if (completionException != null)
     {
         result2.invoker.host.FaultServiceHostIfNecessary(completionException);
     }
 }
コード例 #2
0
                private RunAndGetResponseAsyncResult(ControlOperationInvoker.ControlOperationAsyncResult control, TimeoutHelper timeoutHelper, AsyncCallback callback, object state) : base(callback, state)
                {
                    this.control       = control;
                    this.timeoutHelper = timeoutHelper;
                    bool flag = true;

                    if (control.getInstanceContext.WorkflowCreationContext.CreateOnly)
                    {
                        flag = this.Suspend();
                    }
                    else
                    {
                        flag = this.Run();
                    }
                    if (flag)
                    {
                        base.Complete(true);
                    }
                }
コード例 #3
0
 public static ControlOperationInvoker.ControlOperationAsyncResult.RunAndGetResponseAsyncResult Create(ControlOperationInvoker.ControlOperationAsyncResult control, TimeoutHelper timeoutHelper, AsyncCallback callback, object state)
 {
     return(new ControlOperationInvoker.ControlOperationAsyncResult.RunAndGetResponseAsyncResult(control, timeoutHelper, callback, state));
 }
コード例 #4
0
            private static bool HandleEndOperation(IAsyncResult result)
            {
                ControlOperationInvoker.ControlOperationAsyncResult asyncState = (ControlOperationInvoker.ControlOperationAsyncResult)result.AsyncState;
                if (asyncState.invoker.isControlOperation)
                {
                    switch (asyncState.invoker.operationName)
                    {
                    case "Suspend":
                    case "TransactedSuspend":
                        asyncState.workflowServiceInstance.EndSuspend(result);
                        goto Label_01E6;

                    case "Unsuspend":
                    case "TransactedUnsuspend":
                        asyncState.workflowServiceInstance.EndUnsuspend(result);
                        goto Label_01E6;

                    case "Terminate":
                    case "TransactedTerminate":
                        asyncState.workflowServiceInstance.EndTerminate(result);
                        goto Label_01E6;

                    case "Run":
                    case "TransactedRun":
                        asyncState.workflowServiceInstance.EndRun(result);
                        goto Label_01E6;

                    case "Cancel":
                    case "TransactedCancel":
                        asyncState.workflowServiceInstance.EndCancel(result);
                        goto Label_01E6;

                    case "Abandon":
                        asyncState.workflowServiceInstance.EndAbandon(result);
                        goto Label_01E6;
                    }
                    throw Fx.AssertAndThrow("Unreachable code");
                }
                if (asyncState.getInstanceContext.WorkflowCreationContext != null)
                {
                    asyncState.returnValue = asyncState.EndRunAndGetResponse(result, out asyncState.outputs);
                }
                else
                {
                    try
                    {
                        asyncState.returnValue = asyncState.invoker.OnEndServiceOperation(asyncState.workflowServiceInstance, out asyncState.outputs, result);
                    }
                    catch (FaultException)
                    {
                        throw;
                    }
                    catch (Exception exception)
                    {
                        if (Fx.IsFatal(exception))
                        {
                            throw;
                        }
                        if (!asyncState.ShouldAbandonReceiveContext())
                        {
                            throw;
                        }
                        return(asyncState.AbandonReceiveContext(exception));
                    }
                }
Label_01E6:
                return(true);
            }
コード例 #5
0
            private static bool HandleEndGetInstance(IAsyncResult result)
            {
                ControlOperationInvoker.ControlOperationAsyncResult asyncState = (ControlOperationInvoker.ControlOperationAsyncResult)result.AsyncState;
                bool shouldAbandon = true;

                try
                {
                    try
                    {
                        asyncState.workflowServiceInstance = asyncState.invoker.instanceManager.EndGetInstance(result);
                        shouldAbandon = false;
                    }
                    catch (InstanceLockedException exception)
                    {
                        RedirectionException exception2;
                        if (asyncState.TryCreateRedirectionException(exception, out exception2))
                        {
                            throw System.ServiceModel.Activities.FxTrace.Exception.AsError(exception2);
                        }
                        throw System.ServiceModel.Activities.FxTrace.Exception.AsError(CreateFaultException(exception));
                    }
                    catch (OperationCanceledException exception3)
                    {
                        asyncState.BufferReceiveHelper(ref shouldAbandon, true);
                        throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new RetryException(null, exception3));
                    }
                    catch (InstancePersistenceException exception4)
                    {
                        asyncState.BufferReceiveHelper(ref shouldAbandon, false);
                        if (exception4 is InstanceKeyNotReadyException)
                        {
                            asyncState.invoker.host.RaiseUnknownMessageReceived(asyncState.operationContext.IncomingMessage);
                        }
                        asyncState.invoker.host.FaultServiceHostIfNecessary(exception4);
                        throw System.ServiceModel.Activities.FxTrace.Exception.AsError(CreateFaultException(exception4));
                    }
                }
                catch (Exception exception5)
                {
                    if (Fx.IsFatal(exception5))
                    {
                        throw;
                    }
                    if (!shouldAbandon || !asyncState.ShouldAbandonReceiveContext())
                    {
                        throw;
                    }
                    return(asyncState.AbandonReceiveContext(exception5));
                }
                if (!asyncState.instanceKey.IsValid && (asyncState.instanceId == Guid.Empty))
                {
                    ContextMessageProperty contextMessageProperty = null;
                    if (!ContextMessageProperty.TryGet(asyncState.operationContext.OutgoingMessageProperties, out contextMessageProperty))
                    {
                        contextMessageProperty = new ContextMessageProperty();
                        contextMessageProperty.Context.Add("instanceId", Guid.NewGuid().ToString());
                        contextMessageProperty.AddOrReplaceInMessageProperties(asyncState.operationContext.OutgoingMessageProperties);
                    }
                    else
                    {
                        contextMessageProperty.Context["instanceId"] = Guid.NewGuid().ToString();
                    }
                }
                return(asyncState.PerformOperation());
            }
コード例 #6
0
 private static bool HandleEndAbandonReceiveContext(IAsyncResult result)
 {
     ControlOperationInvoker.ControlOperationAsyncResult asyncState = (ControlOperationInvoker.ControlOperationAsyncResult)result.AsyncState;
     asyncState.receiveContext.EndAbandon(result);
     throw System.ServiceModel.Activities.FxTrace.Exception.AsError(asyncState.operationException);
 }
コード例 #7
0
 public static object End(out object[] outputs, IAsyncResult result)
 {
     ControlOperationInvoker.ControlOperationAsyncResult result2 = AsyncResult.End <ControlOperationInvoker.ControlOperationAsyncResult>(result);
     outputs = result2.outputs;
     return(result2.returnValue);
 }
 private RunAndGetResponseAsyncResult(ControlOperationInvoker.ControlOperationAsyncResult control, TimeoutHelper timeoutHelper, AsyncCallback callback, object state) : base(callback, state)
 {
     this.control = control;
     this.timeoutHelper = timeoutHelper;
     bool flag = true;
     if (control.getInstanceContext.WorkflowCreationContext.CreateOnly)
     {
         flag = this.Suspend();
     }
     else
     {
         flag = this.Run();
     }
     if (flag)
     {
         base.Complete(true);
     }
 }