Beispiel #1
0
 internal override void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter)
 {
     responseFormatter = new ToReply();
     foreach (KeyValuePair <string, InArgument> pair in this.Parameters)
     {
         responseFormatter.Parameters.Add(InArgument.CreateReference(pair.Value, pair.Key));
     }
 }
 internal override void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter)
 {
     responseFormatter = new ToReply();
     foreach (KeyValuePair<string, InArgument> pair in this.Parameters)
     {
         responseFormatter.Parameters.Add(InArgument.CreateReference(pair.Value, pair.Key));
     }
 }
        protected override void CacheMetadata(ActivityMetadata metadata)
        {
            if (this.Request == null)
            {
                metadata.AddValidationError(System.ServiceModel.Activities.SR.SendReplyRequestCannotBeNull(base.DisplayName));
            }
            MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, true, base.DisplayName, (this.Request != null) ? this.Request.OperationName : string.Empty);
            string operationName = (this.Request != null) ? this.Request.OperationName : null;

            this.InternalContent.CacheMetadata(metadata, this, operationName);
            if (this.correlationInitializers != null)
            {
                for (int i = 0; i < this.correlationInitializers.Count; i++)
                {
                    CorrelationInitializer initializer = this.correlationInitializers[i];
                    initializer.ArgumentName = "Parameter" + i;
                    RuntimeArgument argument = new RuntimeArgument(initializer.ArgumentName, Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(initializer.CorrelationHandle, argument);
                    metadata.AddArgument(argument);
                }
            }
            if (!metadata.HasViolations)
            {
                this.internalSend = this.CreateInternalSend();
                this.InternalContent.ConfigureInternalSendReply(this.internalSend, out this.responseFormatter);
                InArgument <CorrelationHandle> replyHandleFromReceive = this.GetReplyHandleFromReceive();
                if (replyHandleFromReceive != null)
                {
                    InArgument <CorrelationHandle> binding = MessagingActivityHelper.CreateReplyCorrelatesWith(replyHandleFromReceive);
                    RuntimeArgument argument4 = new RuntimeArgument("InternalSendCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(binding, argument4);
                    metadata.AddArgument(argument4);
                    this.internalSend.CorrelatesWith = (InArgument <CorrelationHandle>)InArgument.CreateReference(binding, "InternalSendCorrelatesWith");
                    if (this.responseFormatter != null)
                    {
                        InArgument <CorrelationHandle> argument5 = MessagingActivityHelper.CreateReplyCorrelatesWith(replyHandleFromReceive);
                        RuntimeArgument argument6 = new RuntimeArgument("ResponseFormatterCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                        metadata.Bind(argument5, argument6);
                        metadata.AddArgument(argument6);
                        this.responseFormatter.CorrelatesWith = (InArgument <CorrelationHandle>)InArgument.CreateReference(argument5, "ResponseFormatterCorrelatesWith");
                    }
                }
            }
            else
            {
                this.internalSend      = null;
                this.responseFormatter = null;
            }
            metadata.SetImportedChildrenCollection(new Collection <Activity>());
        }
 internal override void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter)
 {
     if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage)
     {
         internalSendMessage.Message = new InArgument <System.ServiceModel.Channels.Message>(context => ((InArgument <System.ServiceModel.Channels.Message>) this.Message).Get(context));
         responseFormatter           = null;
     }
     else
     {
         responseFormatter = new ToReply();
         if (MessageBuilder.IsMessageContract(this.InternalDeclaredMessageType))
         {
             responseFormatter.Result = InArgument.CreateReference(this.Message, "Message");
         }
         else if (this.Message != null)
         {
             responseFormatter.Parameters.Add(InArgument.CreateReference(this.Message, "Message"));
         }
     }
 }
        internal override void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter)
        {
            if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage)
            {
                internalSendMessage.Message = new InArgument <Message>(context => ((InArgument <Message>) this.Message).Get(context));
                responseFormatter           = null;
            }
            else
            {
                responseFormatter = new ToReply();

                // WCF rule dictates that MessageContract must be bound to ReturnValue, not Parameters
                if (MessageBuilder.IsMessageContract(this.InternalDeclaredMessageType))
                {
                    responseFormatter.Result = InArgument.CreateReference(this.Message, "Message");
                }
                else if (this.Message != null)
                {
                    responseFormatter.Parameters.Add(InArgument.CreateReference(this.Message, "Message"));
                }
            }
        }
Beispiel #6
0
 internal abstract void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter);
        internal override void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter)
        {
            if (this.InternalDeclaredMessageType == MessageDescription.TypeOfUntypedMessage)
            {
                internalSendMessage.Message = new InArgument<Message>(context => ((InArgument<Message>)this.Message).Get(context));
                responseFormatter = null;
            }
            else
            {
                responseFormatter = new ToReply();

                // WCF rule dictates that MessageContract must be bound to ReturnValue, not Parameters
                if (MessageBuilder.IsMessageContract(this.InternalDeclaredMessageType))
                {
                    responseFormatter.Result = InArgument.CreateReference(this.Message, "Message");
                }
                else if (this.Message != null)
                {
                    responseFormatter.Parameters.Add(InArgument.CreateReference(this.Message, "Message"));
                }
            }
        }
        protected override void CacheMetadata(ActivityMetadata metadata)
        {
            if (this.Request == null)
            {
                metadata.AddValidationError(SR.SendReplyRequestCannotBeNull(this.DisplayName));
            }

            // validate Correlation Initializers
            MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, true, this.DisplayName, (this.Request != null ? this.Request.OperationName : String.Empty));

            // Validate Content
            string operationName = this.Request != null ? this.Request.OperationName : null;
            this.InternalContent.CacheMetadata(metadata, this, operationName);

            if (this.correlationInitializers != null)
            {
                for (int i = 0; i < this.correlationInitializers.Count; i++)
                {
                    CorrelationInitializer initializer = this.correlationInitializers[i];
                    initializer.ArgumentName = Constants.Parameter + i;
                    RuntimeArgument initializerArgument = new RuntimeArgument(initializer.ArgumentName, Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(initializer.CorrelationHandle, initializerArgument);
                    metadata.AddArgument(initializerArgument);
                }
            }

            if (!metadata.HasViolations)
            {
                this.internalSend = CreateInternalSend();
                this.InternalContent.ConfigureInternalSendReply(this.internalSend, out this.responseFormatter);

                InArgument<CorrelationHandle> requestReplyHandleFromReceive = GetReplyHandleFromReceive();
                if (requestReplyHandleFromReceive != null)
                {
                    InArgument<CorrelationHandle> internalSendCorrelatesWith = MessagingActivityHelper.CreateReplyCorrelatesWith(requestReplyHandleFromReceive);
                    
                    RuntimeArgument internalSendCorrelatesWithArgument = new RuntimeArgument("InternalSendCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(internalSendCorrelatesWith, internalSendCorrelatesWithArgument);
                    metadata.AddArgument(internalSendCorrelatesWithArgument);

                    this.internalSend.CorrelatesWith = (InArgument<CorrelationHandle>)InArgument.CreateReference(internalSendCorrelatesWith, "InternalSendCorrelatesWith");

                    if (this.responseFormatter != null)
                    {
                        InArgument<CorrelationHandle> responseFormatterCorrelatesWith = MessagingActivityHelper.CreateReplyCorrelatesWith(requestReplyHandleFromReceive);

                        RuntimeArgument responseFormatterCorrelatesWithArgument = new RuntimeArgument("ResponseFormatterCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                        metadata.Bind(responseFormatterCorrelatesWith, responseFormatterCorrelatesWithArgument);
                        metadata.AddArgument(responseFormatterCorrelatesWithArgument);

                        responseFormatter.CorrelatesWith = (InArgument<CorrelationHandle>)InArgument.CreateReference(responseFormatterCorrelatesWith, "ResponseFormatterCorrelatesWith");
                    }
                }
            }
            else
            {
                this.internalSend = null;
                this.responseFormatter = null;
            }

            // We don't have any imported children despite referencing the Request
            metadata.SetImportedChildrenCollection(new Collection<Activity>());
        }
 internal abstract void ConfigureInternalSendReply(InternalSendMessage internalSendMessage, out ToReply responseFormatter);
Beispiel #10
0
        protected override void CacheMetadata(ActivityMetadata metadata)
        {
            if (this.Request == null)
            {
                metadata.AddValidationError(SR.SendReplyRequestCannotBeNull(this.DisplayName));
            }

            // validate Correlation Initializers
            MessagingActivityHelper.ValidateCorrelationInitializer(metadata, this.correlationInitializers, true, this.DisplayName, (this.Request != null ? this.Request.OperationName : String.Empty));

            // Validate Content
            string operationName = this.Request != null ? this.Request.OperationName : null;

            this.InternalContent.CacheMetadata(metadata, this, operationName);

            if (this.correlationInitializers != null)
            {
                for (int i = 0; i < this.correlationInitializers.Count; i++)
                {
                    CorrelationInitializer initializer = this.correlationInitializers[i];
                    initializer.ArgumentName = Constants.Parameter + i;
                    RuntimeArgument initializerArgument = new RuntimeArgument(initializer.ArgumentName, Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(initializer.CorrelationHandle, initializerArgument);
                    metadata.AddArgument(initializerArgument);
                }
            }

            if (!metadata.HasViolations)
            {
                this.internalSend = CreateInternalSend();
                this.InternalContent.ConfigureInternalSendReply(this.internalSend, out this.responseFormatter);

                InArgument <CorrelationHandle> requestReplyHandleFromReceive = GetReplyHandleFromReceive();
                if (requestReplyHandleFromReceive != null)
                {
                    InArgument <CorrelationHandle> internalSendCorrelatesWith = MessagingActivityHelper.CreateReplyCorrelatesWith(requestReplyHandleFromReceive);

                    RuntimeArgument internalSendCorrelatesWithArgument = new RuntimeArgument("InternalSendCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                    metadata.Bind(internalSendCorrelatesWith, internalSendCorrelatesWithArgument);
                    metadata.AddArgument(internalSendCorrelatesWithArgument);

                    this.internalSend.CorrelatesWith = (InArgument <CorrelationHandle>)InArgument.CreateReference(internalSendCorrelatesWith, "InternalSendCorrelatesWith");

                    if (this.responseFormatter != null)
                    {
                        InArgument <CorrelationHandle> responseFormatterCorrelatesWith = MessagingActivityHelper.CreateReplyCorrelatesWith(requestReplyHandleFromReceive);

                        RuntimeArgument responseFormatterCorrelatesWithArgument = new RuntimeArgument("ResponseFormatterCorrelatesWith", Constants.CorrelationHandleType, ArgumentDirection.In);
                        metadata.Bind(responseFormatterCorrelatesWith, responseFormatterCorrelatesWithArgument);
                        metadata.AddArgument(responseFormatterCorrelatesWithArgument);

                        responseFormatter.CorrelatesWith = (InArgument <CorrelationHandle>)InArgument.CreateReference(responseFormatterCorrelatesWith, "ResponseFormatterCorrelatesWith");
                    }
                }
            }
            else
            {
                this.internalSend      = null;
                this.responseFormatter = null;
            }

            // We don't have any imported children despite referencing the Request
            metadata.SetImportedChildrenCollection(new Collection <Activity>());
        }