Пример #1
0
 /// <summary>
 /// Helper method for assigning common proxy-specific settings such as channel timeout
 /// </summary>
 /// <param name="proxy">The service proxy</param>
 /// <param name="options">The options to configure on the service proxy</param>
 public static void SetProxyOptions(this DiscoveryServiceProxy proxy, DiscoveryServiceProxyOptions options)
 {
     if (!options.Timeout.Equals(TimeSpan.Zero) &&
         options.Timeout > TimeSpan.Zero)
     {
         proxy.Timeout = options.Timeout;
     }
 }
Пример #2
0
        /// <summary>
        /// Demonstrates a parallelized submission of multiple discovery requests with service proxy options
        /// 3. Timeout = Increase the default 2 minute timeout on the channel to 5 minutes.
        /// </summary>
        /// <param name="requests">The collection of requests to execute in parallel</param>
        /// <returns>The collection of responses</returns>
        public IEnumerable <DiscoveryResponse> ParallelExecuteWithOptions(List <DiscoveryRequest> requests)
        {
            IEnumerable <DiscoveryResponse> responses = null;

            var options = new DiscoveryServiceProxyOptions()
            {
                Timeout = new TimeSpan(0, 5, 0)
            };

            try
            {
                responses = this.Manager.ParallelProxy.Execute(requests, options);
            }
            catch (AggregateException ae)
            {
                // Handle exceptions
            }

            return(responses);
        }