internal AsyncWcfCallContext PrepareCall(AsyncCallback callback, object state, object proxy, object result) { var context = new AsyncWcfCallContext(callback, state, asyncType, result); callContext = context; return(context); }
private void CallBeginMethod(IInvocation invocation, AsyncWcfCallContext context) { context.Init(invocation.Method, invocation.Arguments); PerformInvocation(invocation, wcfInvocation => { var message = context.CreateBeginMessage(); var returnMessage = channelHolder.RealProxy.Invoke(message) as IMethodReturnMessage; wcfInvocation.ReturnValue = context.PostProcess(returnMessage); }); }
protected override void PerformInvocation(IInvocation invocation) { if (callContext == null) { base.PerformInvocation(invocation); return; } var context = callContext; callContext = null; CallBeginMethod(invocation, context); }
private static IMethodReturnMessage CallEndMethod(AsyncWcfCallContext context, out object[] outs) { outs = new object[0]; var message = context.CreateEndMessage(); var returnMessage = context.ChannelHolder.RealProxy.Invoke(message) as IMethodReturnMessage; if (returnMessage.Exception != null) { throw returnMessage.Exception; } outs = message.OutArgs; return(returnMessage); }
protected override void PerformInvocation(IInvocation invocation, IWcfChannelHolder channelHolder) { if (callContext == null) { base.PerformInvocation(invocation, channelHolder); return; } var context = callContext; callContext = null; CallBeginMethod(invocation, context, channelHolder); }
private IMethodReturnMessage CallEndMethod(AsyncWcfCallContext context, out object[] outs) { outs = new object[0]; var message = context.CreateEndMessage(); var returnMessage = channelHolder.RealProxy.Invoke(message) as IMethodReturnMessage; if (returnMessage.Exception != null) { var exception = ExceptionHelper.PreserveStackTrace(returnMessage.Exception); throw exception; } outs = message.OutArgs; return(returnMessage); }
internal AsyncWcfCallContext PrepareCall(AsyncCallback callback, object state, object proxy, object result) { var channelHolder = proxy as IWcfChannelHolder; if (channelHolder == null) { throw new ArgumentException( "The given proxy is not supported. Did you create it using the WcfFacility? " + "If the answer is yes, this is probably a bug so please report it."); } var context = new AsyncWcfCallContext(callback, state, asyncType, channelHolder, result); callContext = context; return(context); }
internal IAsyncResult Begin(AsyncCallback callback, object state) { context = wcfAsyncInterceptor.PrepareCall(WrapCallback(callback), state, proxy, GetDefaultReturnValue()); onBegin(proxy); return(context.AsyncResult); }
public TResult EndCall <TResult>(AsyncWcfCallContext context, out object[] outs) { var returnMessage = CallEndMethod(context, out outs); return((TResult)returnMessage.ReturnValue); }
public void EndCall(AsyncWcfCallContext context, out object[] outs) { CallEndMethod(context, out outs); }