开发者

C# MVC.NET Nested RenderAction's

I wish to have a home page with various "widgets" on them that display data from various controllers found in my site. I w开发者_高级运维ant the widgets displayed to depend on the role of the authenticated user. Since a lot of the widgets will appear on multiple views, my current approach is to have each widget represented by a view. Each role will also have its own view which is composed of multiple RenderAction calls various widget views. The homepage will call RenderAction to display the appropriate view for the authenticated user's role.

Questions:

1) Are there any performance issues with having multiple nested RenderAction calls on my homepage?

2) Is there any other approach that I should consider?


RenderAction will be a tiny bit slower than RenderPartial, for example. However, performance should be measured relative to your goals meaning that it's possible that RenderAction will be fast enough. Before attempting to optimize you should always measure.

And if you are doing database connections in those child actions it won't really matter how you render the results.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜