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); } } }
public IAsyncResult InvokeBegin(object instance, object[] inputs, IInvokeReceivedNotification notification, AsyncCallback callback, object state) { if (inputs == null) { throw System.ServiceModel.Activities.FxTrace.Exception.ArgumentNull("inputs"); } return(new ControlOperationAsyncResult(this, inputs, notification, TimeSpan.MaxValue, callback, state)); }
public ControlOperationAsyncResult(ControlOperationInvoker invoker, object[] inputs, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.instanceKey = InstanceKey.InvalidKey; this.additionalKeys = emptyKeyCollection; this.outputs = ControlOperationInvoker.emptyObjectArray; this.invoker = invoker; this.inputs = inputs; this.timeoutHelper = new TimeoutHelper(timeout); this.transaction = Transaction.Current; this.operationContext = OperationContext.Current; base.OnCompleting = onCompleting; bool flag = false; bool flag2 = false; try { if (notification != null) { if (this.operationContext.SessionId == null) { notification.NotifyInvokeReceived(); } else { this.notification = notification; } } if (invoker.BufferedReceiveManager != null) { ReceiveContext.TryGet(this.operationContext.IncomingMessageProperties, out this.receiveContext); } flag = this.Process(); flag2 = true; } finally { if (!flag2) { Finally(this, null); } } if (flag) { base.Complete(true); } }
private WorkflowOperationContext(object[] inputs, System.ServiceModel.OperationContext operationContext, string operationName, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.inputs = inputs; this.operationName = operationName; this.OperationContext = operationContext; this.CurrentTransaction = currentTransaction; this.performanceCountersEnabled = performanceCountersEnabled; this.propagateActivity = propagateActivity; this.timeoutHelper = new TimeoutHelper(timeout); this.workflowInstance = workflowInstance; this.thisLock = new object(); this.notification = notification; base.OnCompleting = onCompleting; this.bookmark = behavior.OnResolveBookmark(this, out this.bookmarkScope, out this.bookmarkValue); bool flag = false; try { if (TraceUtility.MessageFlowTracingOnly) { this.e2eActivityId = TraceUtility.GetReceivedActivityId(this.OperationContext); DiagnosticTrace.ActivityId = this.e2eActivityId; } if (this.workflowInstance.BufferedReceiveManager != null) { ReceiveContext.TryGet(this.OperationContext.IncomingMessageProperties, out this.receiveContext); this.OperationContext.IncomingMessageProperties.Remove(ReceiveContext.Name); } flag = this.ProcessRequest(); } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } base.OnCompleting(this, exception); throw; } if (flag) { base.Complete(true); } }
protected virtual IAsyncResult OnBeginServiceOperation(WorkflowServiceInstance durableInstance, OperationContext operationContext, object[] inputs, Transaction currentTransaction, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) { return(new ServiceOperationAsyncResult(this.innerInvoker, durableInstance, inputs, operationContext, currentTransaction, notification, callback, state)); }
public object Invoke(object instance, object[] inputs, IInvokeReceivedNotification notification, out object[] outputs) { throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new NotImplementedException()); }
public ControlOperationAsyncResult(ControlOperationInvoker invoker, object[] inputs, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.invoker = invoker; this.inputs = inputs; this.timeoutHelper = new TimeoutHelper(timeout); this.transaction = Transaction.Current; this.operationContext = OperationContext.Current; this.OnCompleting = onCompleting; bool completeSelf = false; bool success = false; try { if (notification != null) { if (this.operationContext.SessionId == null) { // Datagram messages are completely concurrent to loadOrCreate and instance operations. Same as WCF's ConcurrencyMode.Single notification.NotifyInvokeReceived(); } else { // For session, we will notify after we enter into WorkflowServiceInstance pending queue. // This achieves synchronization and ordered messages within a session and concurrent across distinct sessions. this.notification = notification; } } if (invoker.BufferedReceiveManager != null) { if (!ReceiveContext.TryGet(this.operationContext.IncomingMessageProperties, out this.receiveContext)) { Fx.Assert("ReceiveContext expected when BufferedReceives are enabled"); } } completeSelf = this.Process(); success = true; } finally { // in the success cases, OnCompleting has us covered if (!success) { Finally(this, null); } } if (completeSelf) { this.Complete(true); } }
public IAsyncResult InvokeBegin(object instance, object[] inputs, IInvokeReceivedNotification notification, AsyncCallback callback, object state) { if (inputs == null) { throw FxTrace.Exception.ArgumentNull("inputs"); } //Fetch Instance and Dispatch. return new ControlOperationAsyncResult(this, inputs, notification, TimeSpan.MaxValue, callback, state); }
WorkflowOperationContext(object[] inputs, OperationContext operationContext, string operationName, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, WorkflowServiceInstance workflowInstance, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, ServiceEndpoint endpoint, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.inputs = inputs; this.operationName = operationName; this.OperationContext = operationContext; this.ServiceEndpoint = endpoint; this.CurrentTransaction = currentTransaction; this.performanceCountersEnabled = performanceCountersEnabled; this.propagateActivity = propagateActivity; this.timeoutHelper = new TimeoutHelper(timeout); this.workflowInstance = workflowInstance; this.thisLock = new object(); this.notification = notification; this.OnCompleting = onCompleting; // Resolve bookmark Fx.Assert(behavior != null, "behavior must not be null!"); this.bookmark = behavior.OnResolveBookmark(this, out this.bookmarkScope, out this.bookmarkValue); Fx.Assert(this.bookmark != null, "bookmark must not be null!"); bool completeSelf = false; try { // set activity ID on the executing thread ( if (TraceUtility.MessageFlowTracingOnly) { this.e2eActivityId = TraceUtility.GetReceivedActivityId(this.OperationContext); DiagnosticTraceBase.ActivityId = this.e2eActivityId; } if (Fx.Trace.IsEtwProviderEnabled) { this.eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(this.OperationContext.IncomingMessage); } // Take ownership of the ReceiveContext when buffering is enabled by removing the property if (this.workflowInstance.BufferedReceiveManager != null) { if (!ReceiveContext.TryGet(this.OperationContext.IncomingMessageProperties, out this.receiveContext)) { Fx.Assert("ReceiveContext expected when BufferedReceives are enabled"); } this.OperationContext.IncomingMessageProperties.Remove(ReceiveContext.Name); } completeSelf = ProcessRequest(); } catch (Exception e) { if (Fx.IsFatal(e)) { throw; } // Failing synchronously is one case where AsyncResult won't handle calling OnCompleting OnCompleting(this, e); throw; } if (completeSelf) { base.Complete(true); } }
public static IAsyncResult BeginProcessRequest(WorkflowServiceInstance workflowInstance, OperationContext operationContext, string operationName, object[] inputs, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, ServiceEndpoint endpoint, TimeSpan timeout, AsyncCallback callback, object state) { Fx.Assert(inputs != null, "Null inputs"); return(new WorkflowOperationContext(inputs, operationContext, operationName, performanceCountersEnabled, propagateActivity, currentTransaction, workflowInstance, notification, behavior, endpoint, timeout, callback, state)); }
protected override IAsyncResult OnBeginServiceOperation(WorkflowServiceInstance workflowInstance, OperationContext operationContext, object[] inputs, Transaction currentTransaction, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) { Fx.Assert(workflowInstance != null, "caller must verify"); Fx.Assert(inputs != null, "caller must verify"); return WorkflowOperationContext.BeginProcessRequest(workflowInstance, operationContext, this.OperationName, inputs, this.performanceCountersEnabled, this.propagateActivity, currentTransaction, notification, this.behavior, this.endpoint, timeout, callback, state); }
public IAsyncResult InvokeBegin(object instance, object[] inputs, IInvokeReceivedNotification notification, AsyncCallback callback, object state) { if (inputs == null) { throw System.ServiceModel.Activities.FxTrace.Exception.ArgumentNull("inputs"); } return new ControlOperationAsyncResult(this, inputs, notification, TimeSpan.MaxValue, callback, state); }
public object Invoke(object instance, object[] inputs, IInvokeReceivedNotification notification, out object[] outputs) { throw FxTrace.Exception.AsError(new NotImplementedException()); }
public static IAsyncResult BeginProcessRequest(WorkflowServiceInstance workflowInstance, OperationContext operationContext, string operationName, object[] inputs, bool performanceCountersEnabled, bool propagateActivity, Transaction currentTransaction, IInvokeReceivedNotification notification, WorkflowOperationBehavior behavior, ServiceEndpoint endpoint, TimeSpan timeout, AsyncCallback callback, object state) { Fx.Assert(inputs != null, "Null inputs"); return new WorkflowOperationContext(inputs, operationContext, operationName, performanceCountersEnabled, propagateActivity, currentTransaction, workflowInstance, notification, behavior, endpoint, timeout, callback, state); }
//This is the dispatch call for Non-IWorkflowInstanceManagement Operations. protected virtual IAsyncResult OnBeginServiceOperation(WorkflowServiceInstance durableInstance, OperationContext operationContext, object[] inputs, Transaction currentTransaction, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) { return new ServiceOperationAsyncResult(this.innerInvoker, durableInstance, inputs, operationContext, currentTransaction, notification, callback, state); }
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) { //Mode2: Derived invoker should have handled this call. throw Fx.AssertAndThrow("Cannot reach this path without innerInvoker"); } if (this.innerInvoker.IsSynchronous) { TransactionScope scope = TransactionHelper.CreateTransactionScope(this.currentTransaction); try { using (new OperationContextScopeHelper(this.operationContext)) { IManualConcurrencyOperationInvoker manualInvoker = this.innerInvoker as IManualConcurrencyOperationInvoker; if (manualInvoker != null) { this.returnValue = manualInvoker.Invoke(this.durableInstance, this.inputs, this.notification, out this.outputs); } else { this.returnValue = this.innerInvoker.Invoke(this.durableInstance, this.inputs, out this.outputs); } } } finally { TransactionHelper.CompleteTransactionScope(ref scope); } this.Complete(true); } else { IAsyncResult result; using (PrepareTransactionalCall(this.currentTransaction)) { using (new OperationContextScopeHelper(this.operationContext)) { IManualConcurrencyOperationInvoker manualInvoker = this.innerInvoker as IManualConcurrencyOperationInvoker; if (manualInvoker != null) { result = manualInvoker.InvokeBegin(this.durableInstance, this.inputs, this.notification, this.PrepareAsyncCompletion(handleEndInvoke), this); } else { result = this.innerInvoker.InvokeBegin(this.durableInstance, this.inputs, this.PrepareAsyncCompletion(handleEndInvoke), this); } } } if (SyncContinue(result)) { this.Complete(true); } } }
protected override IAsyncResult OnBeginServiceOperation(WorkflowServiceInstance workflowInstance, OperationContext operationContext, object[] inputs, Transaction currentTransaction, IInvokeReceivedNotification notification, TimeSpan timeout, AsyncCallback callback, object state) { Fx.Assert(workflowInstance != null, "caller must verify"); Fx.Assert(inputs != null, "caller must verify"); return(WorkflowOperationContext.BeginProcessRequest(workflowInstance, operationContext, this.OperationName, inputs, this.performanceCountersEnabled, this.propagateActivity, currentTransaction, notification, this.behavior, this.endpoint, timeout, callback, state)); }