slide1 n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
ASP.NET MVC PowerPoint Presentation
Download Presentation
ASP.NET MVC

Loading in 2 Seconds...

play fullscreen
1 / 35

ASP.NET MVC - PowerPoint PPT Presentation


  • 109 Views
  • Uploaded on

ASP.NET MVC. Scott Hanselman Senior Program Manager Microsoft. Hello Cheesy. demo. Scott Hanselman Senior Program Manager Microsoft. What’s the Point?. This is not Web Forms 4.0 It’s about alternatives. Car vs. Motorcycle. Flexible Extend it. Or not. Fundamental

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'ASP.NET MVC' - emily


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
asp net mvc

ASP.NET MVC

Scott Hanselman

Senior Program Manager

Microsoft

hello cheesy

Hello Cheesy

demo

Scott Hanselman

Senior Program Manager

Microsoft

what s the point
What’s the Point?
  • This is not Web Forms 4.0
    • It’s about alternatives. Car vs. Motorcycle.
  • Flexible
    • Extend it. Or not.
  • Fundamental
    • Part of System.Web and isn’t going anywhere.
  • Plays Well With Others
    • Feel free to use NHibernate for Models, Brail for Views and Whatever for Controllers.
  • Keep it simple and DRY
goodness driving goals
Goodness – Driving Goals
  • Maintain Clean Separation of Concerns
    • Easy Testing
    • Red/Green TDD
    • Highly maintainable applications by default
  • Extensible and Pluggable
    • Support replacing any component of the system
goodness driving goals1
Goodness – Driving Goals
  • Enable clean URLs and HTML
    • SEO and REST friendly URL structures
  • Great integration within ASP.NET
    • All the same providers still work
    • Membership, Session, Caching, etc.
    • ASP.NET Designer Surface in VS2008
it s still asp net
It’s still ASP.NET
  • Providers still work
    • Membership, Caching, Session, etc.
  • Views leverage .aspx and .ascx
    • But they don’t have to if you don’t want them to
  • Within System.Web namespace
  • Feature Sharing
a little more detail
A Little More Detail
  • Browser requests /Products/
  • Route is determined
  • Controller is activated
  • Method on Controller is invoke
  • Controller does some stuff
  • Renders View, passing in custom ViewData
      • URLs are rendered, pointing to other Controllers
what is mvc
What is MVC?

Step 1

Incoming request directed to Controller

Controller

Request

what is mvc1
What is MVC?

Step 2

Controller processes request and forms a data Model

Controller

Model

what is mvc2
What is MVC?

Step 3

Model is passed to View

Controller

View

what is mvc3
What is MVC?

Step 4

View transforms Model into appropriate output format

Controller

View

what is mvc4
What is MVC?

Step 5

Response is rendered

Controller

View

Response

request lifecycle

Request Lifecycle

demo

Scott Hanselman

Senior Program Manager

Microsoft

routing

Routing

demo

Scott Hanselman

Senior Program Manager

Microsoft

extensibility
Extensibility
  • Views
  • Controllers
  • Models
  • Routes

…are all Pluggable

viewengines
ViewEngines
  • View Engines render output
  • You get WebForms by default
  • Can implement your own
    • MVCContrib has ones for Brail, Nvelocity
    • NHaml is an interesting one to watch
  • View Engines can be used to
    • Offer new DSLs to make HTML easier
    • Generate totally different mime/types
      • Images, RSS, JSON, XML, OFX, VCards, whatever.
views
Views

<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true"

CodeBehind="List.aspx" Inherits="MvcApplication5.Views.Products.List" Title="Products" %>

<asp:ContentContentPlaceHolderID="MainContentPlaceHolder" runat="server">

<h2><%= ViewData.CategoryName %></h2>

<ul>

<% foreach (var product in ViewData.Products) { %>

<li>

<%= product.ProductName %>

<div class="editlink">

(<%= Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID })%>)

</div>

</li>

<% } %>

</ul>

<%= Html.ActionLink("Add New Product", new { Action="New" }) %>

</asp:Content>

nhaml extreme views
NHaml – Extreme Views

%h2= ViewData.CategoryName%ul

- foreach (var product in ViewData.Products) %li = product.ProductName .editlink = Html.ActionLink("Edit", new { Action="Edit", ID=product.ProductID }) = Html.ActionLink("Add New Product", new { Action="New" })

testing controller actions
Testing Controller Actions
  • No requirement to test within ASP.NET runtime.
    • Use Moq or RhinoMocks or TypeMock
    • Create Test versions of the parts of the runtime you want to stub
slide22

TDD

demo

Scott Hanselman

Senior Program Manager

Microsoft

complete ish application

Complete (ish) Application

demo

Scott Hanselman

Senior Program Manager

Microsoft

what s the point1
What’s the Point?
  • This is not Web Forms 4.0
    • It’s about alternatives. Car vs. Motorcycle.
  • Flexible
    • Extend it. Or not.
  • Fundamental
    • Part of System.Web and isn’t going anywhere.
  • Plays Well With Others
    • Feel free to use NHibernate for Models, Brail for Views and Whatever for Controllers.
  • Keep it simple and DRY
you might be an mvc if
You Might be an MVC if…

With Apologies to Jeff Foxworthy

  • You want full control over markup
  • You want a framework that enforces separation of concerns
  • TDD/Unit Testing is a priority for you
  • Control abstractions get in your way more than they help
  • You like writing Javascript
you might be a webform if
You Might be a WebForm if…

With Apologies to Jeff Foxworthy

  • You like programming against controls that encapsulate UI and logic
  • You like the WYSWIG designer and would rather avoid angle brackets
  • You like keeping logic on the server rather than hand writing Javascript
resources
Resources
  • www.microsoft.com/teched

Tech·TalksTech·Ed Bloggers

Live Simulcasts Virtual Labs

  • http://microsoft.com/technet
    • Evaluation licenses, pre-released products, and MORE!
  • http://microsoft.com/msdn

Developer’s Kit, Licenses, and MORE!

resources for developers
Resources for Developers

http://www.asp.net

http://www.silverlight.net

http://www.msdn.com

http://www.microsoft.com/teched

asp net community www asp net
ASP.NET Community – www.asp.net
  • Great Learning Content
    • 219 Videos, 83 Tutorials, Starter Kits,Webcasts, Podcasts, suggested Books
  • Questions? Need an Answer (Forums)
    • Over 132,000 new questions a year
    • 72% answered within 7-days
  • Stay up-to-date with Blogs
  • Download the latest alphas, betas, and releases
  • Participate, Contribute, Summit, Learn
    • ASP.NET Wiki, Control Gallery
be well write good code and stay in touch scottha@microsoft com http hanselman com
Be well,write good code,and stay in touchscottha@microsoft.comhttp://hanselman.com
slide35

© 2008 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.

The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.