문제

I wish to have a home page with various "widgets" on them that display data from various controllers found in my site. I want 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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top