When is it right to use ViewData instead of ViewModels?

后端 未结 4 1366
死守一世寂寞
死守一世寂寞 2021-01-11 18:28

Assuming you wanted to develop your Controllers so that you use a ViewModel to contain data for the Views you render, should all data be contained within the ViewMo

4条回答
  •  既然无缘
    2021-01-11 19:10

    In terms of ASP.NET MVC 2, ViewModel pattern is the preferred approach. The approach takes full advantage of compile time static type checking. This in combination with compiling mvc views will make your development work-flow much faster and more productive since errors are detected during build/compile time as opposed to run time.

提交回复
热议问题