Ejemplo n.º 1
0
        public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, DispatchRuntime dispatchRuntime)
        {
            var parameterInspector = new WcfTrialsParameterInspector(_serviceIdentifier);

            dispatchRuntime.ChannelDispatcher.ErrorHandlers.Add(parameterInspector);
            dispatchRuntime.InstanceProvider = new WcfTrialsInstanceProvider(_serviceType);
            foreach (var operation in dispatchRuntime.Operations)
            {
                operation.ParameterInspectors.Add(parameterInspector);
            }
        }
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            var parameterInspector = new WcfTrialsParameterInspector(_serviceIdentifier);
            var instanceProvider   = new WcfTrialsInstanceProvider(_serviceType);

            foreach (ChannelDispatcher channelDispatcher in serviceHostBase.ChannelDispatchers)
            {
                channelDispatcher.ErrorHandlers.Add(parameterInspector);
                foreach (var endpoint in channelDispatcher.Endpoints)
                {
                    endpoint.DispatchRuntime.InstanceProvider = instanceProvider;
                    foreach (var operation in endpoint.DispatchRuntime.Operations)
                    {
                        operation.ParameterInspectors.Add(parameterInspector);
                    }
                }
            }
        }