internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext context = rpc.InstanceContext;

            if (context != null)
            {
                try
                {
                    if (rpc.Operation.ReleaseInstanceAfterCall)
                    {
                        if (context.State == CommunicationState.Opened)
                        {
                            context.ReleaseServiceInstance();
                        }
                    }
                    else if (releaseServiceInstanceOnTransactionComplete &&
                             this.isSynchronized &&
                             rpc.transaction != null &&
                             (rpc.transaction.IsCompleted || (rpc.Error != null)))
                    {
                        if (context.State == CommunicationState.Opened)
                        {
                            context.ReleaseServiceInstance();
                        }
                        if (DiagnosticUtility.ShouldTraceInformation)
                        {
                            TraceUtility.TraceEvent(TraceEventType.Information,
                                                    TraceCode.TxReleaseServiceInstanceOnCompletion,
                                                    SR.GetString(SR.TraceCodeTxReleaseServiceInstanceOnCompletion, "*"));
                        }
                    }
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }

                try
                {
                    context.UnbindRpc(ref rpc);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }
            }
        }
        internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext instanceContext = rpc.InstanceContext;

            if (instanceContext != null)
            {
                try
                {
                    if (rpc.Operation.ReleaseInstanceAfterCall)
                    {
                        if (instanceContext.State == CommunicationState.Opened)
                        {
                            instanceContext.ReleaseServiceInstance();
                        }
                    }
                    else if (((this.releaseServiceInstanceOnTransactionComplete && this.isSynchronized) && (rpc.transaction != null)) && (rpc.transaction.IsCompleted || (rpc.Error != null)))
                    {
                        if (instanceContext.State == CommunicationState.Opened)
                        {
                            instanceContext.ReleaseServiceInstance();
                        }
                        if (DiagnosticUtility.ShouldTraceInformation)
                        {
                            TraceUtility.TraceEvent(TraceEventType.Information, 0xe000c, System.ServiceModel.SR.GetString("TraceCodeTxReleaseServiceInstanceOnCompletion", new object[] { "*" }));
                        }
                    }
                }
                catch (Exception exception)
                {
                    if (Fx.IsFatal(exception))
                    {
                        throw;
                    }
                    error.HandleError(exception);
                }
                try
                {
                    instanceContext.UnbindRpc(ref rpc);
                }
                catch (Exception exception2)
                {
                    if (Fx.IsFatal(exception2))
                    {
                        throw;
                    }
                    error.HandleError(exception2);
                }
            }
        }
        internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext context = rpc.InstanceContext;

            if (context != null)
            {
                try
                {
                    context.UnbindRpc(ref rpc);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }
            }
        }
Exemple #4
0
        internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext context = rpc.InstanceContext;

            if (context != null)
            {
                try
                {
                    context.UnbindRpc(ref rpc);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }
            }
        }
        internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
        {
            InstanceContext context = rpc.InstanceContext;

            if (context != null)
            {
                try
                {
                    if (rpc.Operation.ReleaseInstanceAfterCall)
                    {
                        if (context.State == CommunicationState.Opened)
                        {
                            context.ReleaseServiceInstance();
                        }
                    }
                    else if (releaseServiceInstanceOnTransactionComplete &&
                            this.isSynchronized &&
                            rpc.transaction != null &&
                            (rpc.transaction.IsCompleted || (rpc.Error != null)))
                    {
                        if (context.State == CommunicationState.Opened)
                        {
                            context.ReleaseServiceInstance();
                        }
                        if (DiagnosticUtility.ShouldTraceInformation)
                        {
                            TraceUtility.TraceEvent(TraceEventType.Information,
                                                                         TraceCode.TxReleaseServiceInstanceOnCompletion,
                                                                         SR.GetString(SR.TraceCodeTxReleaseServiceInstanceOnCompletion, "*"));
                        }
                    }
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }

                try
                {
                    context.UnbindRpc(ref rpc);
                }
                catch (Exception e)
                {
                    if (Fx.IsFatal(e))
                    {
                        throw;
                    }
                    error.HandleError(e);
                }
            }
        }
 internal void AfterReply(ref MessageRpc rpc, ErrorBehavior error)
 {
     InstanceContext instanceContext = rpc.InstanceContext;
     if (instanceContext != null)
     {
         try
         {
             if (rpc.Operation.ReleaseInstanceAfterCall)
             {
                 if (instanceContext.State == CommunicationState.Opened)
                 {
                     instanceContext.ReleaseServiceInstance();
                 }
             }
             else if (((this.releaseServiceInstanceOnTransactionComplete && this.isSynchronized) && (rpc.transaction != null)) && (rpc.transaction.IsCompleted || (rpc.Error != null)))
             {
                 if (instanceContext.State == CommunicationState.Opened)
                 {
                     instanceContext.ReleaseServiceInstance();
                 }
                 if (DiagnosticUtility.ShouldTraceInformation)
                 {
                     TraceUtility.TraceEvent(TraceEventType.Information, 0xe000c, System.ServiceModel.SR.GetString("TraceCodeTxReleaseServiceInstanceOnCompletion", new object[] { "*" }));
                 }
             }
         }
         catch (Exception exception)
         {
             if (Fx.IsFatal(exception))
             {
                 throw;
             }
             error.HandleError(exception);
         }
         try
         {
             instanceContext.UnbindRpc(ref rpc);
         }
         catch (Exception exception2)
         {
             if (Fx.IsFatal(exception2))
             {
                 throw;
             }
             error.HandleError(exception2);
         }
     }
 }