private void OnMessage(NativeActivityContext executionContext, Bookmark bookmark, object state)
        {
            WorkflowOperationContext context = state as WorkflowOperationContext;

            if (context == null)
            {
                throw System.ServiceModel.Activities.FxTrace.Exception.AsError(new InvalidOperationException(System.ServiceModel.Activities.SR.WorkflowMustBeHosted));
            }
            CorrelationResponseContext responseContext = new CorrelationResponseContext {
                WorkflowOperationContext = context
            };
            ReceiveMessageInstanceData instance = new ReceiveMessageInstanceData(responseContext);

            this.SetupTransaction(executionContext, instance);
        }
 internal bool TryAcquireResponseContext(NativeActivityContext executionContext, out CorrelationResponseContext responseContext)
 {
     if (this.ResponseContext != null)
     {
         // We have a context, and we should disassociate it from the correlation handle
         this.noPersistHandle.Exit(executionContext);
         responseContext = this.ResponseContext;
         this.ResponseContext = null;
         return true;
     }
     else
     {
         responseContext = null;
         return false;
     }
 }
        internal bool TryRegisterResponseContext(NativeActivityContext executionContext, CorrelationResponseContext responseContext)
        {
            Fx.Assert(responseContext != null, "requires a valid responseContext");
            if (this.noPersistHandle == null)
            {
                return false;
            }
            if (this.ResponseContext == null)
            {
                this.noPersistHandle.Enter(executionContext);
                this.ResponseContext = responseContext;
                return true;
            }

            return object.ReferenceEquals(this.ResponseContext, responseContext);
        }
 internal bool TryRegisterResponseContext(NativeActivityContext executionContext, CorrelationResponseContext responseContext)
 {
     if (this.noPersistHandle == null)
     {
         return(false);
     }
     if (this.ResponseContext == null)
     {
         this.noPersistHandle.Enter(executionContext);
         this.ResponseContext = responseContext;
         return(true);
     }
     return(object.ReferenceEquals(this.ResponseContext, responseContext));
 }
 internal bool TryAcquireResponseContext(NativeActivityContext executionContext, out CorrelationResponseContext responseContext)
 {
     if (this.ResponseContext != null)
     {
         this.noPersistHandle.Exit(executionContext);
         responseContext      = this.ResponseContext;
         this.ResponseContext = null;
         return(true);
     }
     responseContext = null;
     return(false);
 }
 internal bool TryAcquireResponseContext(NativeActivityContext executionContext, out CorrelationResponseContext responseContext)
 {
     if (this.ResponseContext != null)
     {
         this.noPersistHandle.Exit(executionContext);
         responseContext = this.ResponseContext;
         this.ResponseContext = null;
         return true;
     }
     responseContext = null;
     return false;
 }
 public ReceiveMessageInstanceData(CorrelationResponseContext responseContext)
 {
     Fx.Assert(responseContext != null, "responseContext is a required parameter");
     this.CorrelationResponseContext = responseContext;
     this.CorrelationCallbackContext =
         MessagingActivityHelper.CreateCorrelationCallbackContext(responseContext.WorkflowOperationContext.OperationContext.IncomingMessageProperties);
 }
Beispiel #8
0
 internal bool TryAcquireResponseContext(NativeActivityContext executionContext, out CorrelationResponseContext responseContext)
 {
     if (this.ResponseContext != null)
     {
         // We have a context, and we should disassociate it from the correlation handle
         this.noPersistHandle.Exit(executionContext);
         responseContext      = this.ResponseContext;
         this.ResponseContext = null;
         return(true);
     }
     else
     {
         responseContext = null;
         return(false);
     }
 }