ASP.NET MVC ViewModel Pattern

后端 未结 4 1214
广开言路
广开言路 2020-11-27 05:19

EDIT: I made something much better to fill and read data from a view using ViewModels, called it ValueInjecter. http://val

4条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-27 05:27

    We started doing this, but our controllers started becoming monstrous (since our ViewModels were not necessarily mapped 1:1 to our database). To alleviate this, we created Mapper classes that create the ViewModel and then map back to data bound for the database. The controller then just calls the Mapper class methods. Seems to work well.

提交回复
热议问题