public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            DispatchBehaviorApplied = true;

            var inspector = new MessageInspector();

            inspector.RequestReceived += delegate(ref Message message, IClientChannel channel, InstanceContext instanceContext)
            {
                if (RequestReceived != null)
                {
                    return(RequestReceived(ref message, channel, instanceContext));
                }
                else
                {
                    return(null);
                }
            };
            inspector.ReplySending += delegate(ref Message reply, object correlationState)
            {
                if (ReplySending != null)
                {
                    ReplySending(ref reply, correlationState);
                }
            };
            endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
        }
        public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
        {
            ClientBehaviorApplied = true;

            var inspector = new MessageInspector();

            inspector.RequestSending += delegate(ref Message message, IClientChannel channel)
            {
                if (RequestSending != null)
                {
                    return(RequestSending(ref message, channel));
                }
                else
                {
                    return(null);
                }
            };
            inspector.ReplyReceived += delegate(ref Message reply, object correlationState)
            {
                if (ReplyReceived != null)
                {
                    ReplyReceived(ref reply, correlationState);
                }
            };
            clientRuntime.MessageInspectors.Add(inspector);
        }
예제 #3
0
		public void ApplyDispatchBehavior (ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
		{
			DispatchBehaviorApplied = true;

			var inspector = new MessageInspector ();
			inspector.RequestReceived += delegate (ref Message message, IClientChannel channel, InstanceContext instanceContext) {
				if (RequestReceived != null)
					return RequestReceived (ref message, channel, instanceContext);
				else
					return null;
			};
			inspector.ReplySending += delegate (ref Message reply, object correlationState) {
				if (ReplySending != null)
					ReplySending (ref reply, correlationState);
			};
			endpointDispatcher.DispatchRuntime.MessageInspectors.Add (inspector);
		}
예제 #4
0
		public void ApplyClientBehavior (ServiceEndpoint endpoint, ClientRuntime clientRuntime)
		{
			ClientBehaviorApplied = true;

			var inspector = new MessageInspector ();
			inspector.RequestSending += delegate (ref Message message, IClientChannel channel) {
				if (RequestSending != null)
					return RequestSending (ref message, channel);
				else
					return null;
			};
			inspector.ReplyReceived += delegate (ref Message reply, object correlationState) {
				if (ReplyReceived != null)
					ReplyReceived (ref reply, correlationState);
			};
			clientRuntime.MessageInspectors.Add (inspector);
		}