예제 #1
0
 private static void executeWebMethod <ContractType>(Action <ContractType> method, ChannelFactory <ContractType> factory, string action)
 {
     StatusStatics.SetStatus("Performing " + action + ".");
     try {
         using (var channel = (IDisposable)factory.CreateChannel())
             method((ContractType)channel);
     }
     catch (Exception e) {
         throw createWebServiceException(action, e);
     }
     StatusStatics.SetStatus("Performed " + action + ".");
 }
예제 #2
0
        private static ResultType executeWebMethodWithResult <ContractType, ResultType>(
            Func <ContractType, ResultType> method, ChannelFactory <ContractType> factory, string action)
        {
            StatusStatics.SetStatus("Performing " + action + ".");
            ResultType ret;

            try {
                using (var channel = (IDisposable)factory.CreateChannel())
                    ret = method((ContractType)channel);
            }
            catch (Exception e) {
                throw createWebServiceException(action, e);
            }
            StatusStatics.SetStatus("Performed " + action + ".");
            return(ret);
        }