public ServiceOperationAsyncResult(IOperationInvoker innerInvoker, WorkflowServiceInstance durableInstance, object[] inputs, OperationContext operationContext, Transaction currentTransaction, IInvokeReceivedNotification notification, AsyncCallback callback, object state) : base(callback, state) { this.durableInstance = durableInstance; this.operationContext = operationContext; this.inputs = inputs; this.innerInvoker = innerInvoker; this.currentTransaction = currentTransaction; this.notification = notification; if (innerInvoker == null) { throw Fx.AssertAndThrow("Cannot reach this path without innerInvoker"); } if (this.innerInvoker.IsSynchronous) { TransactionScope scope = Fx.CreateTransactionScope(this.currentTransaction); try { using (new OperationContextScopeHelper(this.operationContext)) { IManualConcurrencyOperationInvoker invoker = this.innerInvoker as IManualConcurrencyOperationInvoker; if (invoker != null) { this.returnValue = invoker.Invoke(this.durableInstance, this.inputs, this.notification, out this.outputs); } else { this.returnValue = this.innerInvoker.Invoke(this.durableInstance, this.inputs, out this.outputs); } } } finally { Fx.CompleteTransactionScope(ref scope); } base.Complete(true); } else { IAsyncResult result; using (base.PrepareTransactionalCall(this.currentTransaction)) { using (new OperationContextScopeHelper(this.operationContext)) { IManualConcurrencyOperationInvoker invoker2 = this.innerInvoker as IManualConcurrencyOperationInvoker; if (invoker2 != null) { result = invoker2.InvokeBegin(this.durableInstance, this.inputs, this.notification, base.PrepareAsyncCompletion(handleEndInvoke), this); } else { result = this.innerInvoker.InvokeBegin(this.durableInstance, this.inputs, base.PrepareAsyncCompletion(handleEndInvoke), this); } } } if (base.SyncContinue(result)) { base.Complete(true); } } }
void IExecutionProperty.SetupWorkflowThread() { if (this.SuppressTransaction) { this.scope = new TransactionScope(TransactionScopeOption.Suppress); } else if ((this.executor != null) && this.executor.HasRuntimeTransaction) { this.scope = Fx.CreateTransactionScope(this.executor.CurrentTransaction); } }
private static bool HandleEndInvoke(IAsyncResult result) { bool flag; ControlOperationInvoker.ServiceOperationAsyncResult asyncState = (ControlOperationInvoker.ServiceOperationAsyncResult)result.AsyncState; TransactionScope scope = Fx.CreateTransactionScope(asyncState.currentTransaction); try { using (new OperationContextScopeHelper(asyncState.operationContext)) { asyncState.returnValue = asyncState.innerInvoker.InvokeEnd(asyncState.durableInstance, out asyncState.outputs, result); flag = true; } } finally { Fx.CompleteTransactionScope(ref scope); } return(flag); }