Introduction to ASP.NET MVC

23
Who I am Emad Alashi TTL in eSense Software www.DotNetArabi.com www.EmadAshi.com Twitter: @EmadAshi

description

presents what ASP.NET MVC is and how it is compared to ASP.NET Webforms.

Transcript of Introduction to ASP.NET MVC

Page 1: Introduction to ASP.NET MVC

Who I am

Emad AlashiTTL in eSense Software

www.DotNetArabi.com

www.EmadAshi.com

Twitter: @EmadAshi

Page 2: Introduction to ASP.NET MVC
Page 3: Introduction to ASP.NET MVC

ASP.NET MVCIntroduction to

Page 4: Introduction to ASP.NET MVC

ASP.NET Webforms

• It’s all about Pages• Request pages (*.aspx)• Page lifecycle• Control within the page

• Postback & Viewstate• Tree of controls

Page 5: Introduction to ASP.NET MVC

Webforms Pros

Rich Controls (grids, etc…) RAD Event Driven (Winforms) Statefull

Page 6: Introduction to ASP.NET MVC

Webforms Cons

Less Control No built-in SoC Complicated Page life-cycle Not SEO friendly

URL Big Viewstate at the beginning of the page

Page 7: Introduction to ASP.NET MVC

ASP.NET MVC

Page 8: Introduction to ASP.NET MVC

MVC the pattern

Controller

ModelView

Page 9: Introduction to ASP.NET MVC

ASP.NET MVC

Page 10: Introduction to ASP.NET MVC

ASP.NET MVC

Pipeline:RoutingControllerActionView

High Flexibility

Page 11: Introduction to ASP.NET MVC

Code

Page 12: Introduction to ASP.NET MVC

View Engines

Webforms view engine Bellevue Brail NDjango NHaml NVelocity Razor (favored by Microsoft recently) Spark

Page 13: Introduction to ASP.NET MVC

RazorWebforms

Razor

Page 14: Introduction to ASP.NET MVC

RazorWebforms

Razor

Page 15: Introduction to ASP.NET MVC

Spark

<ul if="products.Any()">

<li each="var p in products">${p.Name}</li>

</ul>

<else>

<p>No products available</p> </else>

Page 16: Introduction to ASP.NET MVC

Filters

IAuthorizationFilter IActionFilter

OnActionExecutingOnActionExecuted

IResultFilterOnResultExecutingOnResultExecuted

IExceptionFilter

Page 17: Introduction to ASP.NET MVC

Built on top of ASP.NET platform

Session Management Memebership Authentication & Authorization Caching Routing Configuration Global.asax Master files etc…

Page 18: Introduction to ASP.NET MVC

ASP.NET MVC Pros

More control SoC SEO friendly TDD Flexible & customizable

Page 19: Introduction to ASP.NET MVC

ASP.NET MVC Cons

Not RAD No rich controls

Page 20: Introduction to ASP.NET MVC

Important

• ASP.NET MVC is web in different taste• Not replacing Webforms• Not better

Page 21: Introduction to ASP.NET MVC

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

Page 23: Introduction to ASP.NET MVC

Q & A

Emad Alashiwww.emadashi.comwww.dotnetarabi.com@EmadAshi