Hi: Am trying to understand the ASP.NET MVC ViewData with respect to its size. Since this object is passed between Controller to View, how big this could be? Say for example, if DataTable is passed from Model, and Controller is going to pass it to View. Is there any bes开发者_如何学编程t practices OR any one had any bad experience to share here?
Thanks in advance.
It is good practice to avoid using ViewData at all, because the form that it used: magic strings with need to unboxing them, and to check for null value before unboxing types that aren't nullable's.
Using ViewModel as a place to put all what the view is using is a good practice.
All the data you are talking about is server side. It is not like asp.net viewata; it does not get passed in the request. Generally speaking, the size of the data elements passed from controller to view is not an issue.
精彩评论