asp.net mvc - Advantages and Disadvantages of having a ViewModel for every Model -


this question has answer here:

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

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

monitor web browser programmatically in Android? -

c# - Using multiple datasets in RDLC -