{"id":5,"date":"2011-02-20T13:39:05","date_gmt":"2011-02-20T11:39:05","guid":{"rendered":"http:\/\/dev.bratched.fr\/en\/?p=5"},"modified":"2011-02-20T13:39:05","modified_gmt":"2011-02-20T11:39:05","slug":"what-features-would-you-like-to-see-in-asp-net-mvc-4","status":"publish","type":"post","link":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/","title":{"rendered":"What features would you like to see in ASP.NET MVC 4?"},"content":{"rendered":"<p>If there was a single feature I would like to see in ASP.NET MVC 4 that would be to remove\/deprecate ViewBag\/ViewData. Those two constructs lead to very ugly code in the views and should be avoided. Here are few of the things I hate about them:<\/p>\n<ul>\n<li>They are not strongly typed and you need to cast in your views in order to obtain the actual type<\/li>\n<li>They are not refactor friendly because they rely on magic strings<\/li>\n<li>They lead to brittle unit tests because of the magic strings<\/li>\n<li>They lead to spaghetti code in the views<\/li>\n<\/ul>\n<p>Here\u2019s the diff patch I would love to see applied for the ViewDataDictionary.cs class in ASP.NET MVC 4:<\/p>\n<div id=\"scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:045d431a-8990-4560-9a19-031dafa24fee\">\n<pre class=\"lang:c# decode:true\">diff --git ViewDataDictionary.cs ViewDataDictionary.cs\nindex 4c6299f..1965e3e 100644\n--- ViewDataDictionary.cs\n+++ ViewDataDictionary.cs\n@@ -95,12 +95,10 @@ namespace System.Web.Mvc {\n\n         public object this[string key] {\n             get {\n-                object value;\n-                _innerDictionary.TryGetValue(key, out value);\n-                return value;\n+                throw new Expcetion(\"Don't use ViewData\");\n             }\n             set {\n-                _innerDictionary[key] = value;\n+                throw new Expcetion(\"Don't use ViewData\");\n             }\n         }<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>If there was a single feature I would like to see in ASP.NET MVC 4 that would be to remove\/deprecate ViewBag\/ViewData. Those two constructs lead to very ugly code in the views and should be avoided. Here are few of the things I hate about them: They are not strongly typed and you need to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[263,265],"tags":[],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Bratched\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Bratched.com | Blog speaking .Net C# Javascript, Wordpress\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"What features would you like to see in ASP.NET MVC 4? | Bratched.com\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2011-02-20T11:39:05+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2011-02-20T11:39:05+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:title\" content=\"What features would you like to see in ASP.NET MVC 4? | Bratched.com\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#article\",\"name\":\"What features would you like to see in ASP.NET MVC 4? | Bratched.com\",\"headline\":\"What features would you like to see in ASP.NET MVC 4?\",\"author\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/author\\\/adminced\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/#organization\"},\"datePublished\":\"2011-02-20T13:39:05+01:00\",\"dateModified\":\"2011-02-20T13:39:05+01:00\",\"inLanguage\":\"en-US\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#webpage\"},\"articleSection\":\".NET, ASP.NET MVC\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/bratched.com\\\/en\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/#listItem\",\"name\":\".NET\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/#listItem\",\"position\":2,\"name\":\".NET\",\"item\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/mvc\\\/#listItem\",\"name\":\"ASP.NET MVC\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/mvc\\\/#listItem\",\"position\":3,\"name\":\"ASP.NET MVC\",\"item\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/mvc\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#listItem\",\"name\":\"What features would you like to see in ASP.NET MVC 4?\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/#listItem\",\"name\":\".NET\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#listItem\",\"position\":4,\"name\":\"What features would you like to see in ASP.NET MVC 4?\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/category\\\/net\\\/mvc\\\/#listItem\",\"name\":\"ASP.NET MVC\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/#organization\",\"name\":\"Bratched.com\",\"description\":\"Blog speaking .Net C# Javascript, Wordpress\",\"url\":\"https:\\\/\\\/bratched.com\\\/en\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/author\\\/adminced\\\/#author\",\"url\":\"https:\\\/\\\/bratched.com\\\/en\\\/author\\\/adminced\\\/\",\"name\":\"Bratched\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/05352dcd40ece2c42e5ae2dd683b460b?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Bratched\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#webpage\",\"url\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/\",\"name\":\"What features would you like to see in ASP.NET MVC 4? | Bratched.com\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/2011\\\/02\\\/20\\\/what-features-would-you-like-to-see-in-asp-net-mvc-4\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/author\\\/adminced\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/author\\\/adminced\\\/#author\"},\"datePublished\":\"2011-02-20T13:39:05+01:00\",\"dateModified\":\"2011-02-20T13:39:05+01:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/bratched.com\\\/en\\\/\",\"name\":\"Bratched.com\",\"description\":\"Blog speaking .Net C# Javascript, Wordpress\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/bratched.com\\\/en\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"What features would you like to see in ASP.NET MVC 4? | Bratched.com","description":"","canonical_url":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#article","name":"What features would you like to see in ASP.NET MVC 4? | Bratched.com","headline":"What features would you like to see in ASP.NET MVC 4?","author":{"@id":"https:\/\/bratched.com\/en\/author\/adminced\/#author"},"publisher":{"@id":"https:\/\/bratched.com\/en\/#organization"},"datePublished":"2011-02-20T13:39:05+01:00","dateModified":"2011-02-20T13:39:05+01:00","inLanguage":"en-US","mainEntityOfPage":{"@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#webpage"},"isPartOf":{"@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#webpage"},"articleSection":".NET, ASP.NET MVC"},{"@type":"BreadcrumbList","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/bratched.com\/en#listItem","position":1,"name":"Home","item":"https:\/\/bratched.com\/en","nextItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/#listItem","name":".NET"}},{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/#listItem","position":2,"name":".NET","item":"https:\/\/bratched.com\/en\/category\/net\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/mvc\/#listItem","name":"ASP.NET MVC"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/mvc\/#listItem","position":3,"name":"ASP.NET MVC","item":"https:\/\/bratched.com\/en\/category\/net\/mvc\/","nextItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#listItem","name":"What features would you like to see in ASP.NET MVC 4?"},"previousItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/#listItem","name":".NET"}},{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#listItem","position":4,"name":"What features would you like to see in ASP.NET MVC 4?","previousItem":{"@type":"ListItem","@id":"https:\/\/bratched.com\/en\/category\/net\/mvc\/#listItem","name":"ASP.NET MVC"}}]},{"@type":"Organization","@id":"https:\/\/bratched.com\/en\/#organization","name":"Bratched.com","description":"Blog speaking .Net C# Javascript, Wordpress","url":"https:\/\/bratched.com\/en\/"},{"@type":"Person","@id":"https:\/\/bratched.com\/en\/author\/adminced\/#author","url":"https:\/\/bratched.com\/en\/author\/adminced\/","name":"Bratched","image":{"@type":"ImageObject","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/05352dcd40ece2c42e5ae2dd683b460b?s=96&d=mm&r=g","width":96,"height":96,"caption":"Bratched"}},{"@type":"WebPage","@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#webpage","url":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/","name":"What features would you like to see in ASP.NET MVC 4? | Bratched.com","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/bratched.com\/en\/#website"},"breadcrumb":{"@id":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/#breadcrumblist"},"author":{"@id":"https:\/\/bratched.com\/en\/author\/adminced\/#author"},"creator":{"@id":"https:\/\/bratched.com\/en\/author\/adminced\/#author"},"datePublished":"2011-02-20T13:39:05+01:00","dateModified":"2011-02-20T13:39:05+01:00"},{"@type":"WebSite","@id":"https:\/\/bratched.com\/en\/#website","url":"https:\/\/bratched.com\/en\/","name":"Bratched.com","description":"Blog speaking .Net C# Javascript, Wordpress","inLanguage":"en-US","publisher":{"@id":"https:\/\/bratched.com\/en\/#organization"}}]},"og:locale":"en_US","og:site_name":"Bratched.com | Blog speaking .Net C# Javascript, Wordpress","og:type":"article","og:title":"What features would you like to see in ASP.NET MVC 4? | Bratched.com","og:url":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/","article:published_time":"2011-02-20T11:39:05+00:00","article:modified_time":"2011-02-20T11:39:05+00:00","twitter:card":"summary","twitter:title":"What features would you like to see in ASP.NET MVC 4? | Bratched.com"},"aioseo_meta_data":{"post_id":"5","title":null,"description":null,"keywords":null,"keyphrases":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"schema_type":null,"schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"location":null,"local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":null,"created":"2020-12-21 02:36:46","updated":"2025-06-04 02:52:38","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/bratched.com\/en\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/bratched.com\/en\/category\/net\/\" title=\".NET\">.NET<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/bratched.com\/en\/category\/net\/mvc\/\" title=\"ASP.NET MVC\">ASP.NET MVC<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tWhat features would you like to see in ASP.NET MVC 4?\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/bratched.com\/en"},{"label":".NET","link":"https:\/\/bratched.com\/en\/category\/net\/"},{"label":"ASP.NET MVC","link":"https:\/\/bratched.com\/en\/category\/net\/mvc\/"},{"label":"What features would you like to see in ASP.NET MVC 4?","link":"https:\/\/bratched.com\/en\/2011\/02\/20\/what-features-would-you-like-to-see-in-asp-net-mvc-4\/"}],"_links":{"self":[{"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/posts\/5"}],"collection":[{"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/comments?post=5"}],"version-history":[{"count":0,"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/posts\/5\/revisions"}],"wp:attachment":[{"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/media?parent=5"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/categories?post=5"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bratched.com\/en\/wp-json\/wp\/v2\/tags?post=5"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}