asp.net mvc - Advantages and Disadvantages of having a ViewModel for every Model -
this question has answer here:
- viewmodel best practices 11 answers
i have mvc app pass models controllers. have handful of situations use viewmodel crud operations done directly. have data annotations on each property in model class use validate model. have heard better practice use viewmodels- 1 each view. seems me unnecessary , programmers nightmare far maintenance concerned. wondering if agreed or disagreed me on this?
i think terms "model" , "viewmodel" confused.
in microsoft-tutorial-mvc-world "model" maps directly database "entity" , can perform crud operations. in medium-large scale asp.net mvc app this.
therefore, build set of "view-related-business-objects" pass backward , forward , views. call them "models" if like. call them "viewmodels" if like. doesn't matter. perform same function. both put "m" in "mvc".
Comments
Post a Comment