/// <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>
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription,
            ServiceHostBase serviceHostBase)
        {
            Requires.IsNotNull(serviceDescription, nameof(serviceDescription));
            Requires.IsNotNull(serviceHostBase, nameof(serviceHostBase));

            var instanceProvider =
                new SimpleInjectorInstanceProvider(this.container, serviceDescription.ServiceType);

            var endpointDispatchers = 
                GetEndpointDispatchersForImplementedContracts(serviceDescription, serviceHostBase);

            foreach (var endpointDispatcher in endpointDispatchers)
            {
                endpointDispatcher.DispatchRuntime.InstanceProvider = instanceProvider;
            }
        }
Example #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>
        public void ApplyDispatchBehavior(ServiceDescription serviceDescription,
                                          ServiceHostBase serviceHostBase)
        {
            Requires.IsNotNull(serviceDescription, "serviceDescription");
            Requires.IsNotNull(serviceHostBase, "serviceHostBase");

            var instanceProvider =
                new SimpleInjectorInstanceProvider(this.container, serviceDescription.ServiceType);

            var endpointDispatchers =
                GetEndpointDispatchersForImplementedContracts(serviceDescription, serviceHostBase);

            foreach (var endpointDispatcher in endpointDispatchers)
            {
                endpointDispatcher.DispatchRuntime.InstanceProvider = instanceProvider;
            }
        }