Ejemplo n.º 1
0
        void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            RoutingExtension routingExtension = new RoutingExtension(this.configuration);

            serviceHostBase.Extensions.Add(routingExtension);
            for (int i = 0; i < serviceHostBase.ChannelDispatchers.Count; i++)
            {
                ChannelDispatcher channelDispatcher = serviceHostBase.ChannelDispatchers[i] as ChannelDispatcher;
                if (channelDispatcher != null)
                {
                    foreach (EndpointDispatcher endpointDispatcher in channelDispatcher.Endpoints)
                    {
                        if (!endpointDispatcher.IsSystemEndpoint &&
                            RoutingUtilities.IsRoutingServiceNamespace(endpointDispatcher.ContractNamespace))
                        {
                            DispatchRuntime dispatchRuntime = endpointDispatcher.DispatchRuntime;
                            //Since we use PerSession instancing this concurrency only applies to messages
                            //in the same session, also needed to maintain order.
                            dispatchRuntime.ConcurrencyMode       = ConcurrencyMode.Single;
                            dispatchRuntime.EnsureOrderedDispatch = this.configuration.EnsureOrderedDispatch;
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void IServiceBehavior.Validate(ServiceDescription serviceDescription, ServiceHostBase serviceHostBase)
        {
            HashSet <string> endpoints = new HashSet <string>();

            foreach (ServiceEndpoint endpoint in serviceDescription.Endpoints)
            {
                if (!endpoint.IsSystemEndpoint &&
                    RoutingUtilities.IsRoutingServiceNamespace(endpoint.Contract.Namespace))
                {
                    endpoint.Behaviors.Add(new RoutingEndpointBehavior(endpoint));
                    endpoints.Add(endpoint.Name);
                }
            }
            EndpointNameMessageFilter.Validate(this.configuration.InternalFilterTable.Keys, endpoints);
        }