DCSIMG
PDC09 - MVC 2 BlackBelt - Noam King's Blog

Noam King's Blog



Jazz It Up !!!
Technologies working in harmony

PDC09 - MVC 2 BlackBelt

Scott Hanselman is on stage :

  • A new syntax in MVC 2 there is a new way to say HTML.Encode which isIMAG0358 just putting a “ : “ in front of what you want to come out.
  • MVC 2 is available in VS2010 b2, and of course you can download it to VS2008.
  • BTW, the empty model folder is just for developers to find it, no special function.
  • You can manipulate the tooling of “add view” with code templates under IMAG0360 “Program files/Visual studio 10.0”. You can drag this folder to your project and choose custom tool in the properties window. This is of course T4 template. (tt extension). looks like classic asp but instead of generating html it generates code. Once those templates are inside a project, they are local overrides. You can also copy and rename one and it shows in the view content combo.
  • About broken links. David Ebo have a Template (T4) called T4MVC.tt. When you use it just give you strong type in front. MVCBuildViews = true in the csproj file will make sure the views are pre-build and the errors like broken links can be found in advance. (on Codeplex)
  • Using Data Annotations, you can mark your class with Data Annotations.
  • An important thing to mention that the term Dynamic data should be mentioned as something that is referring to both MVC and Webforms and less as a technology by itself.
  • using the annotation with HTML.EnableClientValidation on the view makes it use client side (jQuery) validation for example for “Required” annotation. You can of course write meta data dynamically and write custom rules as in DD.
  • Instead of render partial you can write HTML.DisplayForModel() and it assume what to render from the model.
  • Scott recommends MVCContrib and MVC turbine (Codeplex) which is a simple extended framework (using Unity) implementing IRouteRegistrator, or IServiceRegistration, and if you want to move from Unity to Structure Map, it’s a very easy staff.
  • Also another recommendation is to read a lot of posts and comments from the community and not only take the things Microsoft say for granted (like “Nerd Dinner” application implementations).
Published Wednesday, November 18, 2009 10:27 PM by Noam
תגים:, ,

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required) 

Enter the numbers above: