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

前端 未结 4 1372
时光说笑
时光说笑 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:16

    I prefer to use some DTO instead of using viewbag. Using DTO make you strong type your viewdata.

    Hope this helps.

提交回复
热议问题