예제 #1
0
        internal AsyncWcfCallContext PrepareCall(AsyncCallback callback, object state, object proxy, object result)
        {
            var context = new AsyncWcfCallContext(callback, state, asyncType, result);

            callContext = context;
            return(context);
        }
예제 #2
0
 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);
     });
 }
예제 #3
0
        protected override void PerformInvocation(IInvocation invocation)
        {
            if (callContext == null)
            {
                base.PerformInvocation(invocation);
                return;
            }

            var context = callContext;

            callContext = null;

            CallBeginMethod(invocation, context);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }
예제 #8
0
 internal IAsyncResult Begin(AsyncCallback callback, object state)
 {
     context = wcfAsyncInterceptor.PrepareCall(WrapCallback(callback), state, proxy, GetDefaultReturnValue());
     onBegin(proxy);
     return(context.AsyncResult);
 }
예제 #9
0
        public TResult EndCall <TResult>(AsyncWcfCallContext context, out object[] outs)
        {
            var returnMessage = CallEndMethod(context, out outs);

            return((TResult)returnMessage.ReturnValue);
        }
예제 #10
0
 public void EndCall(AsyncWcfCallContext context, out object[] outs)
 {
     CallEndMethod(context, out outs);
 }