Esempio n. 1
0
        public RetryEnabledDisposableServiceChannelProxy(
            Func <ICommunicationObject, DisposableServiceChannelProxy <TServiceInterface> > disposableServiceChannelProxyFactoryMethod,
            Func <ICommunicationObject> serviceChannelFactoryMethod,
            IRetryPolicyFunction retryPolicy) : base(typeof(TServiceInterface))
        {
            this.disposableServiceChannelProxyFactoryMethod = disposableServiceChannelProxyFactoryMethod;
            this.serviceChannelFactoryMethod = serviceChannelFactoryMethod;
            this.RetryPolicy = retryPolicy;

            this.CreateDisposableChannelProxy();
        }
 public TestRetryEnabledDisposableObjectRealProxy(TObjectToProxy objectToProxy, IRetryPolicyFunction retryPolicy)
     : base(typeof(IFakeService), retryPolicy)
 {
     this.obj = objectToProxy;
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServiceConsumer{TServiceInterface}" /> class.
 /// </summary>
 /// <param name="serviceChannelFactoryMethod">The service channel factory method.</param>
 /// <param name="retryPolicy">The retry policy.</param>
 public ServiceConsumer(Func <ICommunicationObject> serviceChannelFactoryMethod, IRetryPolicyFunction retryPolicy)
     : this(new RetryEnabledDisposableServiceChannelProxy <TServiceInterface>(serviceChannelFactoryMethod, retryPolicy))
 {
 }
        private static IServiceConsumer <TServiceInterface> CreateServiceConsumer <TServiceInterface>(Func <ICommunicationObject> factoryMethod, IRetryPolicyFunction retryPolicy, IServiceConsumerExceptionBehaviourStrategy exceptionStrategy, IServiceChannelCloseTriggerStrategy closeTriggerStrategy)
        {
            var consumer = new ServiceConsumer <TServiceInterface>(factoryMethod);

            consumer.ExceptionBehaviourStrategy = exceptionStrategy;
            consumer.RetryPolicy = retryPolicy;
            consumer.ChannelCloseTriggerStrategy = closeTriggerStrategy;
            return(consumer);
        }
        /// <summary>
        /// Creates a <see cref="ServiceConsumer" /> from a factory method that returns a communication object / channel / Visual Studio Service Reference ServiceClient.
        /// </summary>
        /// <typeparam name="TServiceInterface">The type of the service interface.</typeparam>
        /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param>
        /// <param name="retryPolicy">The retry policy.</param>
        /// <param name="exceptionStrategy">The exception strategy.</param>
        /// <param name="closeTriggerStrategy">The service channel close trigger strategy.</param>
        /// <returns>
        /// A <see cref="ServiceConsumer" />.
        /// </returns>
        public static IServiceConsumer <TServiceInterface> Create <TServiceInterface>(string endpointConfigurationName, IRetryPolicyFunction retryPolicy, IServiceConsumerExceptionBehaviourStrategy exceptionStrategy, IServiceChannelCloseTriggerStrategy closeTriggerStrategy)
        {
            Func <ICommunicationObject> factoryMethod = () => ServiceChannelFactory.CreateChannel <TServiceInterface>(endpointConfigurationName);

            return(ServiceConsumerFactory.Create <TServiceInterface>(factoryMethod, retryPolicy, exceptionStrategy, closeTriggerStrategy));
        }
        /// <summary>
        /// Creates a <see cref="ServiceConsumer" /> from a factory method that returns a communication object / channel / Visual Studio Service Reference ServiceClient.
        /// </summary>
        /// <typeparam name="TServiceInterface">The type of the service interface.</typeparam>
        /// <param name="endpointConfigurationName">Name of the endpoint configuration.</param>
        /// <param name="retryPolicy">The retry policy.</param>
        /// <returns>
        /// A <see cref="ServiceConsumer" />.
        /// </returns>
        public static IServiceConsumer <TServiceInterface> Create <TServiceInterface>(string endpointConfigurationName, IRetryPolicyFunction retryPolicy)
        {
            Func <ICommunicationObject> factoryMethod = () => ServiceChannelFactory.CreateChannel <TServiceInterface>(endpointConfigurationName);

            return(ServiceConsumerFactory.Create <TServiceInterface>(factoryMethod, retryPolicy));
        }
 /// <summary>
 /// Creates a <see cref="ServiceConsumer" /> from a factory method that returns a communication object / channel / Visual Studio Service Reference ServiceClient.
 /// </summary>
 /// <typeparam name="TServiceInterface">The type of the service interface.</typeparam>
 /// <param name="factoryMethod">The factory method.</param>
 /// <param name="retryPolicy">The retry policy.</param>
 /// <param name="exceptionStrategy">The exception strategy.</param>
 /// <param name="closeTriggerStrategy">The service channel close trigger strategy.</param>
 /// <returns>
 /// A <see cref="ServiceConsumer" />.
 /// </returns>
 public static IServiceConsumer <TServiceInterface> Create <TServiceInterface>(Func <ICommunicationObject> factoryMethod, IRetryPolicyFunction retryPolicy, IServiceConsumerExceptionBehaviourStrategy exceptionStrategy, IServiceChannelCloseTriggerStrategy closeTriggerStrategy)
 {
     return(CreateServiceConsumer <TServiceInterface>(factoryMethod, retryPolicy, exceptionStrategy, closeTriggerStrategy));
 }
 /// <summary>
 /// Creates a <see cref="ServiceConsumer" /> from a factory method that returns a communication object / channel / Visual Studio Service Reference ServiceClient.
 /// </summary>
 /// <typeparam name="TServiceInterface">The type of the service interface.</typeparam>
 /// <param name="factoryMethod">The factory method.</param>
 /// <param name="retryPolicy">The retry policy.</param>
 /// <returns>
 /// A <see cref="ServiceConsumer" />.
 /// </returns>
 public static IServiceConsumer <TServiceInterface> Create <TServiceInterface>(Func <ICommunicationObject> factoryMethod, IRetryPolicyFunction retryPolicy)
 {
     return(CreateServiceConsumer <TServiceInterface>(factoryMethod, retryPolicy, defaultExceptionBehaviourStrategy, null));
 }
Esempio n. 9
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RetryEnabledDisposableObjectRealProxy" /> class.
 /// </summary>
 /// <param name="typeToProxy">The type to proxy.</param>
 /// <param name="retryPolicy">The retry policy.</param>
 protected RetryEnabledDisposableObjectRealProxy(Type typeToProxy, IRetryPolicyFunction retryPolicy)
     : base(typeToProxy)
 {
     this.retryPolicy = retryPolicy;
 }
Esempio n. 10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RetryEnabledDisposableServiceChannelProxy{TServiceInterface}" /> class.
 /// </summary>
 /// <param name="serviceChannelFactoryMethod">The service channel factory method.</param>
 /// <param name="retryPolicy">The retry policy.</param>
 public RetryEnabledDisposableServiceChannelProxy(Func <ICommunicationObject> serviceChannelFactoryMethod, IRetryPolicyFunction retryPolicy)
     : this(
         (ICommunicationObject serviceChannel) => new DisposableServiceChannelProxy <TServiceInterface>(serviceChannel),
         serviceChannelFactoryMethod,
         retryPolicy)
 {
 }