public void WantsToUseUnusableChannel(IWcfChannelHolder channelHolder, MethodInfo method) { if (Refresh) { channelHolder.RefreshChannel(); } }
public WcfInvocation Refresh(bool force) { var oldChannel = channelHolder.Channel; var channel = channelHolder.RefreshChannel(force); if ((channel != oldChannel) && (invocation is IChangeProxyTarget)) { var changeTarget = (IChangeProxyTarget)invocation; changeTarget.ChangeInvocationTarget(channel); changeTarget.ChangeProxyTarget(channel); } return(this); }
/// <inheritdoc /> public bool Perform(IWcfChannelHolder channelHolder, MethodInfo method, Action action) { bool reconnect = false; try { action(); } catch (ChannelTerminatedException) { reconnect = true; } catch (CommunicationObjectFaultedException) { reconnect = true; } catch (CommunicationObjectAbortedException) { reconnect = true; } catch (MessageSecurityException) { reconnect = true; } catch (CommunicationException cex) { if (cex.GetType() != typeof(CommunicationException)) { throw; } reconnect = true; } if (reconnect) { channelHolder.RefreshChannel(); action(); } return true; }
public WcfInvocation Refresh(bool force) { var oldChannel = channelHolder.Channel; var channel = channelHolder.RefreshChannel(force); if ((channel != oldChannel)) { var changeInvocation = invocation as IChangeProxyTarget; if (changeInvocation != null) { changeInvocation.ChangeInvocationTarget(channel); } var changeProxy = invocation.Proxy as IProxyTargetAccessor; if (changeProxy != null) { changeProxy.DynProxySetTarget(channel); } } return(this); }
protected void ApplyRefreshPolicy(IWcfChannelHolder channelHolder, IInvocation invocation) { if (!channelHolder.IsChannelUsable) { bool hasCustomRefreshPolicy = false; var channelBurden = channelHolder.ChannelBurden; foreach (var refreshPolicy in channelBurden.Dependencies .OfType<IRefreshChannelPolicy>().OrderBy(p => p.ExecutionOrder)) { refreshPolicy.WantsToUseUnusableChannel(channelHolder, invocation.Method); hasCustomRefreshPolicy = true; } if (!hasCustomRefreshPolicy) { channelHolder.RefreshChannel(); } } }