Exemple #1
0
        public static IEnumerable <Customer> GetCustomers()
        {
            if (channelFactory == null)
            {
                GetChannelFactory();
            }

            int tries = 0;

            while (tries++ < 3)
            {
                try
                {
                    if (channel == null)
                    {
                        channel = channelFactory.CreateChannel();
                        channel.Open();
                    }

                    return(channel.GetCustomers());
                }
                catch (CommunicationException)
                {
                    channel.Abort();
                    channel = null;

                    Thread.Sleep(500);
                }
            }

            return(new List <Customer>());
        }