我在我的MVC应用程序中大量使用ViewBag,这被认为是不好的做法吗?我不确定是否花时间创建viewmodel(但我认为它更适合MVVM而不是MVC)或继续大量使用ViewBag.支持和反对的理由是什么?示例控制器方法将返回它的模型(通常是一个简单的域实体)以及以下对ViewBag的调用:
ViewBag.TotalItems = data.Count(); ViewBag.FilteredItems = gridFilters; ViewBag.Action = "Events"; ViewBag.Area = "People"; ViewBag.EntityID = person.EntityID; ViewBag.OrganisationID = ID; ViewBag.Name = string.Format("{0} {1}",person.FirstName,person.LastName); ViewBag.IsEnabled = person.IsEnabled; ViewBag.EntityID = person.EntityID; ViewBag.Favourited = users.IsOnUserFavourites(person.EntityID); ViewBag.Columns = userColumns; ViewBag.Title = "Person : " + string.Format("{0} {1}",person.LastName) + " - Events";