ASP.NET MVC
Intro class MainContoller { function Index() {... raw data HTML CSS JavaScript REQUEST RESPONSE CONTROLLER MODELVIEW
Sample public class MainController : Controller { public ActionResult Index(int id) { var model = new MainModel(id); return View(“Index”, model); } public class MainModel { public int Id; public string Title; public string Content; } MainController.cs MainModel.csIndex.aspx
ASPX vs PHP public class MainController : Controller { public ActionResult Index(int id) { var model = new MainModel(id); return View(“Index”, model); } ” /> MainController.cs Index.aspx class MainController implements Controller { public function Index($id) { $model = new MainModel($id); return $this->View(“Index”, model); } MainController.php Title ?> Content ?> FindFile(“image.jpg”) ?>” /> Index.php
ASP.NET MVC 1.0 community (ms-pl) MVC frame url rewriting and routing basic validation helpers (html generators) page caching
ASP.NET MVC 2.0 templated helpers areas support for Data Annotations client validation AsyncController strongly-typed input helpers bug fixes, minor features
Sample 1 public class ProductViewModel { [Price(MinPrice = 1.99)] public double Price { get; set; } [Required] public string Title { get; set; } }
Sample 2 [ChildActionOnly] public ActionResult Menu() { var menu =... return PartialView(menu); } Partial rendering - builds a string and then sends to output - direct outtput
Community developers extra helpers T4 templates localization programming techniques blogs, tutorials partial caching (donut caching) webshop (cart, order, PayPal) Oxite
Road map MVC (pattern) – 1979 ASP.NET MVC 1.0 – 17th mar 2009 ASP.NET MVC 2.0 RC – 17th dec 2009 ASP.NET MVC 2.0 – ?, integrated in VS2010
Links Wikipedia: MVC