Ejemplo n.º 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);
        }
Ejemplo n.º 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);
     });
 }
Ejemplo n.º 3
0
        protected override void PerformInvocation(IInvocation invocation)
        {
            if (callContext == null)
            {
                base.PerformInvocation(invocation);
                return;
            }

            var context = callContext;

            callContext = null;

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

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