Upload
ezra-flynn
View
223
Download
0
Embed Size (px)
Citation preview
ASP.NET MVC – Hands on 2
Dev One is your dedicated partner providing high quality experts on architecture, development, and testing roles on IT projects using Microsoft .NET technologies.
Visit us on:http://www.dev-one.com
We wi l l he lp your enterpr ise to bui ld a state of the art so lut ion us ing the latest avai lable technologies so you can rapidly deploy your appl icat ions and serv ices.
Our proven exper ience, and a deep understanding of your bus iness, wi l l he lp us to you reduce your IT development costs and let your employees concentrate on your core bus iness.
We are a imed at provid ing consul tancy experts on archi tecture , development, and test ing ro les, especia l ly us ing the .NET technologies and the Microsoft ecosystem.
With more than 10 years of mult ip le IT development exper iences, we have forged a set of sk i l l s through var ious pro ject & miss ions in several act iv i ty sectors that enables us to de l iver you high qual i ty serv ices.
ABOUT DEV ONE
ASP.NET MVC – Hands on 3
Presentation What is MVC? MVC on the web today ASP.NET MVC Timeline
Comparison with ASP.NET web forms What web forms does well Where web forms doesn’t fi t ASP.NET MVC believes Should you fear ASP.NET MVC?
The MVC pattern Model View Controller
What’s new in ASP.NET MVC 3 Demos Q & A
AGENDA
ASP.NET MVC – Hands on 5
The MVC pattern is 30+ years old! It is a powerful and elegant means of separating
concerns It makes it easier to test application It promotes parallel development thanks to the loose
coupling between the three main components
WHAT IS MVC?
ASP.NET MVC – Hands on 6
Ruby on RailsDjango and PythonSpring, Struts and JavaZend Framework and PHPMonoRail…
MVC ON THE WEB TODAY
ASP.NET MVC – Hands on 7
Separation of application tasks (input logic, business logic, and UI logic), testability, and test-driven development (TDD) by default
An extensible and pluggable frameworkA powerful URL-mapping component that lets you
build applications that have comprehensible and searchable URLs
Convention over configurationDon’t repeat yourself, keep it simple (DRY/KISS
principles)
ASP.NET MVC
ASP.NET MVC – Hands on 8
TIMELINE
• ScottGu sketched out the core of ASP.NET MVC (~100 lines of code)
February 2007
• Presenstation of Scalene at the Austin ALT.NET conference
September 2007 • First
Community Technology Preview
December 2007
• ASP.NET MVC 1.0
March 2009• ASP.NET MVC source code was released under the MS-PL
April 2009
• ASP.NET MVC 2.0
• Shipped with Visual Studio 2010
March 2010• ASP.NET MVC 3.0
• Shipped with Visual Studio 2010
January 2011
ASP.NET MVC – Hands on 10
Represent a Page as control treeGive these server-side controls events like their
desktop counterpartsHide as much HTTP and HTML as is reasonableMake state management as transparent as possible
WHAT WEB FORMS DOES WELL
ASP.NET MVC – Hands on 11
ViewState is powerful, but it has its drawbacks (weight,…)
Page life cycle can be a nightmareLimited control over HTMLClient IDs and the
ctl00$ContentPlaceHolder1$UserControl1$TextBox1 syndrome It’s nearly impossible to run a Web Form through its
life cycle outside IIS
WHERE WEB FORMS DOESN’T FIT
ASP.NET MVC – Hands on 12
Guiding tenets: Be extensible, maintainable, and flexible Be testable Get out of the user’s way when necessary
Serving methods, not fi lesSeparation of concernsScottHa said: « ASP.NET MVC is Web Forms
unplugged »
ASP.NET MVC BELIEVES
ASP.NET MVC – Hands on 13
ASP.NET MVC is built on top of ASP.NETASP.NET MVC is not a replacement for anything It is just an alternative It’s a totally diff erent approach
SHOULD YOU FEAR ASP.NET MVC?
ASP.NET MVC – Hands on 15
Model objects are the parts of the
application that implement the logic for the application’s data domain
View components that display the
application’s user interfaceController
components that handle user interaction, work with the model, and ultimately select a view to render
THE MVC PATTERN
ASP.NET MVC – Hands on 16
Business logic and validation of the application’s data domain
Totally independant from the views or the controllersModel state can be stored in memory, database, XML
fi les,…
MODEL
ASP.NET MVC – Hands on 17
Application’s user interface using data from the model
No interaction with the models or the controllersViews can be strongly typedAlmost no code
VIEW
ASP.NET MVC – Hands on 18
Handle user interactionQuery the modelSelect the right view to render
CONTROLLER
ASP.NET MVC – Hands on 20
Razor View Engine Support for multiple view engine Global action fi lters « ViewBag » property New « ActionResult » types JavaScript and AJAX improvements Client-side validation enabled by default Remote validator JSON binding support Data annotations metadata attributes Validation interfaces Dependency injection improvements Partial-Page Output Caching Granular Control over Request Validation …
WHAT’S NEW IN ASP.NET MVC 3
ASP.NET MVC – Hands on 22
Using the ASP.NET MVC 3 template and playing around with Razor
First data access and display a list of authorsManage authorsDisplay a list of booksCreate and edit a book using the ViewModel pattern
Source code available on: http://vil.rs/qK3rMG
BOOK STORE