When is it “acceptable” to use ViewBag/ViewData in ASP.NET MVC?

前端 未结 4 1375
时光说笑
时光说笑 2021-02-05 19:03

I realize that the best practice is to use strongly typed Views and pass in all needed data in a ViewModel, but I am curious if there are situations where it is actually conside

4条回答
  •  醉话见心
    2021-02-05 19:11

    I use them rarely, for bits of information that are totally unrelated to the model or view model that I'm passing to the view, again, most of the times I use a view model

提交回复
热议问题