开发者

asp.net MVC RenderAction coordinator

We're looking at the ASP.NET MVC 2 beta RenderAction() method. We like it very much but it seems that we can't use async controllers with it. Does anyone have an example of a "controller" that can figu开发者_StackOverflowre out all the actions that will be called, cache the data, then let the called actions know that their data already exists vs. having to call to get it?

Most of the q's already posted here reference the MVC 1 or earlier previews.


Use Html.RenderPartial() instead

What you're asking here is basically the functionality you'd implement using the old good RenderPartial from MVC 1. Have one action load all data and than rendering partial views instead of controllers checking whether their data is already loaded or not.

And in your particular case what your controller would have to do is to check which view it's goging to render, then parse its content to see which controllers will be called and do that. I don't think that would be feasible in any way shape or form. You're messing with separation of concerns in this particular case, because you're bounding the two together.

Maybe enlighten us with a bit more specifics about the problem that you're actually having.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜