Introduction to ASP.NET MVC
-
Upload
emad-alashi -
Category
Technology
-
view
1.999 -
download
0
description
Transcript of Introduction to ASP.NET MVC
Who I am
Emad AlashiTTL in eSense Software
www.DotNetArabi.com
www.EmadAshi.com
Twitter: @EmadAshi
ASP.NET MVCIntroduction to
ASP.NET Webforms
• It’s all about Pages• Request pages (*.aspx)• Page lifecycle• Control within the page
• Postback & Viewstate• Tree of controls
Webforms Pros
Rich Controls (grids, etc…) RAD Event Driven (Winforms) Statefull
Webforms Cons
Less Control No built-in SoC Complicated Page life-cycle Not SEO friendly
URL Big Viewstate at the beginning of the page
ASP.NET MVC
MVC the pattern
Controller
ModelView
ASP.NET MVC
ASP.NET MVC
Pipeline:RoutingControllerActionView
High Flexibility
Code
View Engines
Webforms view engine Bellevue Brail NDjango NHaml NVelocity Razor (favored by Microsoft recently) Spark
RazorWebforms
Razor
RazorWebforms
Razor
Spark
<ul if="products.Any()">
<li each="var p in products">${p.Name}</li>
</ul>
<else>
<p>No products available</p> </else>
Filters
IAuthorizationFilter IActionFilter
OnActionExecutingOnActionExecuted
IResultFilterOnResultExecutingOnResultExecuted
IExceptionFilter
Built on top of ASP.NET platform
Session Management Memebership Authentication & Authorization Caching Routing Configuration Global.asax Master files etc…
ASP.NET MVC Pros
More control SoC SEO friendly TDD Flexible & customizable
ASP.NET MVC Cons
Not RAD No rich controls
Important
• ASP.NET MVC is web in different taste• Not replacing Webforms• Not better
RESTful (by Roy Fielding)
It’s all about nouns (Resources) A representation of a resource is typically a document
that captures the current or intended state of a resource. URI Stateless Utilizes web architecture (Methods: GET, POST, PUT,
and DELETE) Simple Less bandwidth Generality Human readable
References www.asp.net/mvc Comparing Web Forms And ASP.NET MVC (Dino Esposito) Scott Guthrie: http://weblogs.asp.net/scottgu Scott Hanselman: www.computerzen.com Wikipedia: MVC, RESTful “Pro ASP.NET MVC 2 Framework” book by Steven
Sanderson ASP.net MVC Vs ASP.net Web Form REST vs. SOAP – The Right WebService REST (Representational State Transfer) and RESTful
web services: Methods, Concepts and Examples
Q & A
Emad Alashiwww.emadashi.comwww.dotnetarabi.com@EmadAshi