introduction to asp.net mvc - brad wilsonhow asp.net mvc works routes define how requests are...

22
Introduction to ASP.NET MVC Brad Wilson, ASP.NET MVC team [email protected] http://bradwilson.typepad.com http://twitter.com/bradwilson Thursday, July 9, 2009

Upload: others

Post on 24-Jul-2020

4 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Introduction toASP.NET MVC

Brad Wilson, ASP.NET MVC team

[email protected]://bradwilson.typepad.comhttp://twitter.com/bradwilson

Thursday, July 9, 2009

Page 2: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

ASP.NET WebForms

Thursday, July 9, 2009

Page 3: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

WebForms Illustrated

PageRequest

Thursday, July 9, 2009

Page 4: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

WebForms Illustrated

Page ?Magic

HappensHere

Thursday, July 9, 2009

Page 5: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

WebForms Illustrated

PageResponse

Thursday, July 9, 2009

Page 6: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Model-View-Controller(Separated Presentation)

Thursday, July 9, 2009

Page 7: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Model

Domain-specific representation of data

Business logic

Storage layer is an implementation detail

Thursday, July 9, 2009

Page 8: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

View

Presents data to the user

Read-only views as well as forms

Minimal display-only logic

Thursday, July 9, 2009

Page 9: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Controller

Responds to requests

Connects models to view

Invokes model code as appropriate

Thursday, July 9, 2009

Page 10: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Illustrated

Controller

Request

Thursday, July 9, 2009

Page 11: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Illustrated

Controller

Model

State Change

Thursday, July 9, 2009

Page 12: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Illustrated

Controller

Model

View Display

Thursday, July 9, 2009

Page 13: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Illustrated

Controller

Model

View

Get Data

Thursday, July 9, 2009

Page 14: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Illustrated

Controller

Model

View

Response

Thursday, July 9, 2009

Page 15: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

SingleResponsibility

Principal

Thursday, July 9, 2009

Page 16: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

How ASP.NET MVC Works

Routes define how requests are dispatched

Controller is a class; action is the method that’s executed

By default, views are .aspx files without code-behind

Thursday, July 9, 2009

Page 17: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Demo

Thursday, July 9, 2009

Page 18: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Resources

Thursday, July 9, 2009

Page 19: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Futureshttp://aspnet.codeplex.com/

“Missing” HTML helpers (button, image, mailto)

Expression-based HTML helpers

Asynchronous controllers

Model binders (byte array, LINQ to SQL binary, upload)

Controller attributes (AcceptAjax, ContentType, RequireSsl)

MVC server controls (with designer support)

Thursday, July 9, 2009

Page 20: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

MVC Contribhttp://mvccontrib.codeplex.com/

Dependency Injection Controller FactoriesCastle Windsor, Ninject, Unity, Spring.net, StructureMap

Alternate View EnginesSpark, Brail, NVelocity, XSL-T

Sub-Controllers, Convention ControllerFluent HTML HelpersSnippets for Visual Studio & Resharper

Thursday, July 9, 2009

Page 21: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

http://www.asp.net/mvcDownloads

Online documentation

Step-by-step tutorials

Instructional videos

Site design gallery

Discussion forums

Thursday, July 9, 2009

Page 22: Introduction to ASP.NET MVC - Brad WilsonHow ASP.NET MVC Works Routes define how requests are dispatched Controller is a class; action is the method that’s executed By default,

Blogs

Scott Guthrie http://weblogs.asp.net/scottgu/

Phil Haack http://haacked.com/

Rob Conery http://blog.wekeroad.com/

Scott Hanselman http://www.hanselman.com/

Me! :) http://bradwilson.typepad.com/

Thursday, July 9, 2009