Esempio n. 1
0
        /// <summary>
        /// Implements a modification or extension of the service across an endpoint.
        /// </summary>
        /// <param name="endpoint">The endpoint that exposes the contract.</param>
        /// <param name="endpointDispatcher">The endpoint dispatcher to be modified or extended.</param>
        /// <remarks>Not implemented.</remarks>
        public void ApplyDispatchBehavior(ServiceEndpoint endpoint, EndpointDispatcher endpointDispatcher)
        {
            if (LogExecution)
            {
                Logger.Debug("Executing: ApplyDispatchBehavior(ServiceEndpoint, EndpointDispatcher)");
            }

            if (endpointDispatcher == null)
            {
                throw new ArgumentNullException("endpointDispatcher");
            }

            var inspector = new LogMessageInspector();

            endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
        }
Esempio n. 2
0
        /// <summary>
        /// Provides the ability to change run-time property values or insert custom extension objects such as error handlers, message or parameter interceptors, security extensions, and other custom extension objects.
        /// </summary>
        /// <param name="serviceDescription">The service description.</param>
        /// <param name="serviceHostBase"> The host that is currently being built.</param>
        /// <exception cref="ArgumentNullException">If serviceHostBase is null</exception>
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            if (LogExecution)
            {
                Logger.Debug("Executing: ApplyDispatchBehavior(ServiceDescription, ServiceHostBase)");
            }

            if (serviceHostBase == null)
            {
                throw new ArgumentNullException("serviceHostBase");
            }

            serviceHostBase.ChannelDispatchers
            .Where(cd => cd is ChannelDispatcher)
            .Select(cd => cd as ChannelDispatcher)
            .ToList().ForEach(cd =>
            {
                foreach (EndpointDispatcher endpointDispatcher in cd.Endpoints)
                {
                    var inspector = new LogMessageInspector();
                    endpointDispatcher.DispatchRuntime.MessageInspectors.Add(inspector);
                }
            });
        }