开发者

ASP.net MVC 2.0 Asynchronous Controllers - What happened to the Delegate Pattern?

I'm migrating a project to the MVC 2.0 RTM version, and have hit a snag. I have a couple of asynchronous controllers based upon the older MVCfutures (1.0.0.0)

This previous release let me do very clean asynchronous methods (see below for example)

EDIT: Work around was to retain the previous futures version. Need a solution moving forward though

What happened to the support for this pattern? Can It be reinstated?

Does anyone have any work arounds?

    [Authorize()]
    public Func<ActionResult> Status(int ID)
    {
        var task = new GetTask(ID, GetUserName());
        AsyncManager.OutstandingOperations.Increment();
        MySettings.Tasks.Post(task);
        ImportTaskItem importtask = null;
        Activate(task.responsePort.Receive(
            entity =>
            {
                importtask = new Models.ImportTaskItem((ImportTask)entity);
                AsyncManager.OutstandingOperations.Decrement();
            }));

        return () =>
        {
            if (importtask != null)                
     开发者_如何学Python           return Json(importtask, JsonRequestBehavior.AllowGet);                
            return Json("No Task", JsonRequestBehavior.AllowGet);
        };
    }

Found a forum post which seems to suggest it was dropped in favour of the events pattern - not impressed!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜