Is there any good reason to use FormCollection instead of ViewModel?

前端 未结 11 1546
离开以前
离开以前 2020-11-27 15:09

I\'ve inherited a code base written in ASP.Net MVC 4. Every post method takes a FormCollection. Aside from annoyance of having to access the values through quot

11条回答
  •  时光取名叫无心
    2020-11-27 15:46

    The default model binder will do almost everything you need it to do. I resorted to the FormCollection once - only to later figure out how to bind arrays of elements into a collection on the ViewModel.

    Just go ViewModel. Better all around, for every reason enumerated.

提交回复
热议问题