Забавно, когда новые технологии повторяют твои решения N времени назад
Так как MVC3 поддерживает только .NET 4.0 разработчики фреймворка смогли использовать преимущества новой версии .NET в ASP.NET MVC.
Одним из таких преимуществ является поддержка новых динамических типов. В MVC 3 знакомое свойство ViewData представлено в виде двух динамических реализаций View и ViewModel. Это позволяет вам вместо следующего кода:
Забавно, когда новые технологии повторяют твои решения N времени назад
Id
, you may have run into an issue where your model state is invalid when binding to that model even though you don’t have an “Id” field in your form.UrlParameter.Optional
value. If you set the default value for a URL parameter to this special value, MVC makes sure to remove that key from the route value dictionary so that it doesn’t exist.
script
tag. When the browser sees the script tag, it makes another GET request back to the vulnerable site to load the script, sending the auth cookie along.
Templated Helpers позволяют создавать редакторы для целых объектов. При этом под каждый контроллер может создаваться свой вариант редактора
In the Views\Home folder, create a DisplayTemplates folder.
In the Views\Shared folder, create another DisplayTemplates folder.
The display templates in the Views\Shared\DisplayTemplates folder will be used by all controllers. The display templates in the Views\Home\DisplayTemplates folder will be used by the home controller. Display templates that will be used by more than one controller should be placed in the Views\Shared\DisplayTemplates folder. (If a template with the same name appears in both folders, the template in the Views\Home\DisplayTemplates folder will be used.)