Пример #1
0
        /// <summary>
        /// Initializes an instance of <see cref="HyperServiceHostContainer"/> with the specified <see cref="IServiceHostFactory"/> and <see cref="IServiceHostExceptionHandler"/> implementations.
        /// </summary>
        /// <param name="hostFactory">The <see cref="IServiceHostFactory"/> that is used to create the <see cref="ServiceHost"/> object to wrap.</param>
        /// <param name="timeoutExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when a <see cref="TimeoutException"/> is thrown.</param>
        /// <param name="communicationExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when a <see cref="CommunicationException"/> is thrown.</param>
        /// <param name="genericExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when an <see cref="Exception"/> is thrown that is not a <see cref="TimeoutException"/> or a <see cref="CommunicationException"/>.</param>
        public HyperServiceHostContainer(IServiceHostFactory hostFactory,
                                         IServiceHostExceptionHandler timeoutExceptionHandler,
                                         IServiceHostExceptionHandler communicationExceptionHandler,
                                         IServiceHostExceptionHandler genericExceptionHandler)
        {
            if (hostFactory == null)
            {
                throw new ArgumentNullException(nameof(hostFactory));
            }
            if (timeoutExceptionHandler == null)
            {
                throw new ArgumentNullException(nameof(timeoutExceptionHandler));
            }
            if (communicationExceptionHandler == null)
            {
                throw new ArgumentNullException(nameof(communicationExceptionHandler));
            }
            if (genericExceptionHandler == null)
            {
                throw new ArgumentNullException(nameof(genericExceptionHandler));
            }

            _hostFactory                   = hostFactory;
            _timeoutExceptionHandler       = timeoutExceptionHandler;
            _communicationExceptionHandler = communicationExceptionHandler;
            _genericExceptionHandler       = genericExceptionHandler;

            // By default, this property is true, making the container a one stop shop for ServiceHost management. Users can turn the feature off if they have to though.
            DisposeServiceOnStop = true;
        }
Пример #2
0
 /// <summary>
 /// Initializes an instance of <see cref="HyperServiceHostContainer"/> with the specified factory method and <see cref="IServiceHostExceptionHandler"/> implementations.
 /// </summary>
 /// <param name="factory">The delegate that is invoked to create the <see cref="ServiceHost"/> object to wrap.</param>
 /// <param name="timeoutExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when a <see cref="TimeoutException"/> is thrown.</param>
 /// <param name="communicationExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when a <see cref="CommunicationException"/> is thrown.</param>
 /// <param name="genericExceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when an <see cref="Exception"/> is thrown that is not a <see cref="TimeoutException"/> or a <see cref="CommunicationException"/>.</param>
 public HyperServiceHostContainer(Func <ServiceHost> factory,
                                  IServiceHostExceptionHandler timeoutExceptionHandler,
                                  IServiceHostExceptionHandler communicationExceptionHandler,
                                  IServiceHostExceptionHandler genericExceptionHandler)
     : this(new ServiceHostFactoryMethodWrapper(factory), timeoutExceptionHandler, communicationExceptionHandler, genericExceptionHandler)
 {
 }
Пример #3
0
 /// <summary>
 /// Initializes an instance of <see cref="HyperServiceHostContainer"/> with the specified <see cref="IServiceHostFactory"/> and <see cref="IServiceHostExceptionHandler"/> implementations.
 /// </summary>
 /// <param name="hostFactory">The <see cref="IServiceHostFactory"/> that is used to create the <see cref="ServiceHost"/> object to wrap.</param>
 /// <param name="exceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when any is thrown.</param>
 public HyperServiceHostContainer(IServiceHostFactory hostFactory, IServiceHostExceptionHandler exceptionHandler)
     : this(hostFactory, exceptionHandler, exceptionHandler, exceptionHandler)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes an instance of <see cref="HyperServiceHostContainer"/> with the specified factory method and <see cref="IServiceHostExceptionHandler"/> implementation.
 /// </summary>
 /// <param name="factory">The delegate that is invoked to create the <see cref="ServiceHost"/> object to wrap.</param>
 /// <param name="exceptionHandler">The <see cref="IServiceHostExceptionHandler"/> implementation to use when any is thrown.</param>
 public HyperServiceHostContainer(Func <ServiceHost> factory, IServiceHostExceptionHandler exceptionHandler)
     : this(factory, exceptionHandler, exceptionHandler, exceptionHandler)
 {
 }