Example #1
0
        private object EndCallHelper(ExtAsyncResult asyncResult)
        {
            // prepare call to end method
            MethodInfo endMethod = asyncType.GetMethod("End" + asyncResult.SyncMethod.Name);

            object[] arguments = new object[endMethod.GetParameters().Length];
            arguments[arguments.Length - 1] = asyncResult.WcfAsyncResult;

            object result = endMethod.Invoke(this.asyncChannel, arguments);

            return(result);
        }
Example #2
0
        /// <summary>Async Begin Call </summary>
        /// <param name="func">action containing single call wcfContract.Operation(...) as lambda expression</param>
        /// <param name="callback">async callback</param>
        /// <param name="state">async state </param>
        public ExtAsyncResult <TResult> BeginCall <TResult>(Func <TWcfContract, TResult> func, AsyncCallback callback, object state)
        {
            // collect call data
            MethodInfo syncMethod;

            object[] syncArguments;
            this.callDataCollector.Call(func, out syncMethod, out syncArguments);

            // call
            var returnValue = BeginCall(syncMethod, syncArguments, callback, state);

            // wrap result in order to identify which end method must be called
            var wcfAsyncCall = new ExtAsyncResult <TResult>(returnValue, syncMethod);

            return(wcfAsyncCall);
        }
Example #3
0
        /// <summary>Async End Call </summary>
        /// <param name="asyncResult">the referenced given back by the Begin method</param>
        /// <returns>the result of the call</returns>
        public TResult EndCall <TResult>(ExtAsyncResult <TResult> asyncResult)
        {
            var result = EndCallHelper(asyncResult);

            return((TResult)result);
        }
Example #4
0
 /// <summary>Async End Call </summary>
 /// <param name="asyncResult">the referenced given back by the Begin method</param>
 /// <returns>the result of the call</returns>
 public void EndCall(ExtAsyncResult asyncResult)
 {
     EndCallHelper(asyncResult);
 }