Пример #1
0
        public static void CallMethod <TC, T1, T2, T3>(Action <TC, T1, T2, T3> func, TC client, T1 param1, T2 param2,
                                                       T3 param3, IFaultExceptionAdapter errorAdapter) where TC : ICommunicationObject
        {
            try
            {
                func(client, param1, param2, param3);
            }
            catch (FaultException <ErrorDetail> exp)
            {
                throw errorAdapter.ConvertToException(exp);
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch
            {
                if (client.State == CommunicationState.Faulted)
                {
                    client.Abort();
                }

                throw;
            }
            finally
            {
                try
                {
                    if (client.State != CommunicationState.Faulted)
                    {
                        client.Close();
                    }
                }
                catch
                {
                    client.Abort();
                }
            }
        }
Пример #2
0
        public static T CallMethod <C, T1, T>(Func <C, T1, T> func, C client, T1 param1
                                              , IFaultExceptionAdapter errorAdapter) where C : ICommunicationObject
        {
            try
            {
                return(func(client, param1));
            }
            catch (FaultException <ErrorDetail> exp)
            {
                throw errorAdapter.ConvertToException(exp);
            }
            catch (CommunicationException)
            {
                client.Abort();
                throw;
            }
            catch (TimeoutException)
            {
                client.Abort();
                throw;
            }
            catch
            {
                if (client.State == CommunicationState.Faulted)
                {
                    client.Abort();
                }

                throw;
            }
            finally
            {
                try
                {
                    if (client.State != CommunicationState.Faulted)
                    {
                        client.Close();
                    }
                }
                catch
                {
                    client.Abort();
                }
            }
        }
Пример #3
0
 public CalculationEngineService(IFaultExceptionAdapter errorAdapter)
 {
     this.errorAdapter = errorAdapter;
 }
Пример #4
0
 public PeriodEngineService(IFaultExceptionAdapter errorAdapter)
 {
     this.errorAdapter = errorAdapter;
 }
Пример #5
0
 public UserManagementService(IFaultExceptionAdapter errorAdapter)
 {
     this.errorAdapter = errorAdapter;
 }