Introduction to ASP.NET MVC

Post on 14-Dec-2014

1.999 views 0 download

Tags:

description

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

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

Q & A

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