Exemplo n.º 1
0
        internal AddressableInstanceContextInfo(CalculatorExtension parent, string id)
        {
            this.parent = parent;

            if (String.IsNullOrEmpty(id))
            {
                this.id = Guid.NewGuid().ToString();
            }
            else
            {
                this.id = id;
            }
        }
Exemplo n.º 2
0
        //Apply the custom IInstanceContextProvider to the EndpointDispatcher.DispatchRuntime
        public void ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
        {
            CalculatorExtension extension = new CalculatorExtension();

            foreach (ChannelDispatcherBase dispatcherBase in serviceHostBase.ChannelDispatchers)
            {
                ChannelDispatcher dispatcher = dispatcherBase as ChannelDispatcher;
                foreach (EndpointDispatcher endpointDispatcher in dispatcher.Endpoints)
                {
                    endpointDispatcher.DispatchRuntime.InstanceContextProvider = extension;
                    endpointDispatcher.DispatchRuntime.MessageInspectors.Add(extension);
                }
            }
        }