Exemple #1
0
        protected internal virtual IAsyncResult BeginInvokeActionMethod(
            ControllerContext controllerContext,
            ActionDescriptor actionDescriptor,
            IDictionary <string, object> parameters,
            AsyncCallback callback,
            object state
            )
        {
            AsyncActionDescriptor asyncActionDescriptor = actionDescriptor as AsyncActionDescriptor;

            if (asyncActionDescriptor != null)
            {
                return(BeginInvokeAsynchronousActionMethod(
                           controllerContext,
                           asyncActionDescriptor,
                           parameters,
                           callback,
                           state
                           ));
            }
            else
            {
                return(BeginInvokeSynchronousActionMethod(
                           controllerContext,
                           actionDescriptor,
                           parameters,
                           callback,
                           state
                           ));
            }
        }
Exemple #2
0
        private IAsyncResult BeginInvokeAsynchronousActionMethod(
            ControllerContext controllerContext,
            AsyncActionDescriptor actionDescriptor,
            IDictionary <string, object> parameters,
            AsyncCallback callback,
            object state
            )
        {
            BeginInvokeDelegate beginDelegate = delegate(
                AsyncCallback asyncCallback,
                object asyncState
                )
            {
                return(actionDescriptor.BeginExecute(
                           controllerContext,
                           parameters,
                           asyncCallback,
                           asyncState
                           ));
            };

            EndInvokeDelegate <ActionResult> endDelegate = delegate(IAsyncResult asyncResult)
            {
                object       returnValue = actionDescriptor.EndExecute(asyncResult);
                ActionResult result      = CreateActionResult(
                    controllerContext,
                    actionDescriptor,
                    returnValue
                    );
                return(result);
            };

            return(AsyncResultWrapper.Begin(
                       callback,
                       state,
                       beginDelegate,
                       endDelegate,
                       _invokeActionMethodTag
                       ));
        }
        private IAsyncResult BeginInvokeAsynchronousActionMethod(ControllerContext controllerContext, AsyncActionDescriptor actionDescriptor, IDictionary<string, object> parameters, AsyncCallback callback, object state)
        {
            BeginInvokeDelegate beginDelegate = delegate(AsyncCallback asyncCallback, object asyncState)
            {
                return actionDescriptor.BeginExecute(controllerContext, parameters, asyncCallback, asyncState);
            };

            EndInvokeDelegate<ActionResult> endDelegate = delegate(IAsyncResult asyncResult)
            {
                object returnValue = actionDescriptor.EndExecute(asyncResult);
                ActionResult result = CreateActionResult(controllerContext, actionDescriptor, returnValue);
                return result;
            };

            return AsyncResultWrapper.Begin(callback, state, beginDelegate, endDelegate, _invokeActionMethodTag);
        }