introducing asp net mvc 3
Download
Skip this Video
Download Presentation
Introducing ASP.NET MVC 3

Loading in 2 Seconds...

play fullscreen
1 / 35

Introducing ASP.NET MVC 3 - PowerPoint PPT Presentation


  • 146 Views
  • Uploaded on

Introducing ASP.NET MVC 3. Ori Calvo, 2010 Hi-Tech College [email protected] “If people want to have maximum reach across * all * devices then HTML will provide the broadest reach” Scott Guthrie, Corporate Vice President , Microsoft. Objectives. ASP.NET MVC Basics

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 'Introducing ASP.NET MVC 3' - winka


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
introducing asp net mvc 3

Introducing ASP.NET MVC 3

Ori Calvo, 2010

Hi-Tech College

[email protected]

slide2
“If people want to have maximum reach across *all* devices then HTML will provide the broadest reach”

Scott Guthrie, Corporate Vice President, Microsoft

objectives
Objectives
  • ASP.NET MVC Basics
  • What’s new in ASP.NET MVC 3
  • Summary
prerequisites
Prerequisites
  • ASP.NET Developer
  • Good understanding of HTML and HTTP
  • Good understanding of C# 3.0 Language
  • No ASP.NET MVC Experience is required
quick demo
Quick Demo
  • Create new ASP.NET MVC Project
  • Create new controller
  • Create new View
classical asp net
Classical ASP.NET
  • Huge shift at that time
  • Object oriented approach
  • Compiled web pages
  • Stateful UI
  • Event Driven
  • Drag and Drop Designer
  • Windows Forms Developing Experience
  • Is here to stay !!!
what s wrong with it
What’s wrong with it?
  • Is “Windows Forms” approach suited?
  • Limited control over HTML
  • Encourages mixing of presentation and logic
  • Hard to test
  • ViewState
  • Complex page life cycle
  • Hard to integrate with other libraries
asp net mvc
ASP.NET MVC
  • Separation of concerns
  • Tight control over HTML
  • Designed to be testable
  • Extensible routing system
  • Better integration with 3rd party libraries
  • Open source
  • Built on top of ASP.NET platform
  • Language innovations
software requirements
Software Requirements
  • .NET Framework 4.0
  • Visual Studio 2010
  • Visual Web Developer 2010
  • Can be installed into the bin directory
    • In case the Web Host does not support it directly
  • Installation can be automated by Web Platform Installer
  • Additional components can be installed using NuGet
mvc ingredients
MVC Ingredients
  • Routing System
  • Controller
  • Action
  • Filter
  • View
  • Model
  • Model State
  • View Bag
demo real life controller
Demo – Real life controller
  • GroupController
  • Index View
  • Click a group
  • Back to parent
demo extending views
Demo – Extending Views
  • Partial View - Menu
  • Layouts - Header and footer
  • Sections – Add “scripts” section
demo submitting data
Demo – Submitting Data
  • Create new group
  • Method selector
  • Automatic model binding
  • Validation
  • DataAnnotations
  • Edit a group
  • TryUpdateModel
  • jQuery to set focus
demo controlling access
Demo – Controlling Access
  • Authorize filter
  • FormsAuthentication
  • LoginDetails as ViewModel
demo routing system
Demo – Routing System
  • Simplifying URLs
  • Implement “CMS like” URLs
what s new
What’s new?
  • ASP.NET MVC 3
  • NuGet 1.1
  • IIS Express 7.5
  • SQL Server Compact Edition 4.0
  • Web Deploy and Web Farm Framework 2.0
  • Orchard 1.0
  • Web Matrix 1.0
  • Entity Framework Code First (CTP5)
razor
Razor
  • Just another View Engine
  • Better integration of C# and HTML
  • Is focused around the @ character
  • No need to set the end of code
  • Is testable
  • Is extendible
  • Follows the same compilation model as ASPX
  • Can be compiled at design time
razor syntax
Razor syntax
  • Use @ to move between code and HTML
  • Use @() to specify long expression
  • Use @{} to run arbitrary code which doesn’t writes into the response stream
  • Use @: inside code region to move back to HTML
    • Can also use
  • Use @* and *@ for comments
  • Use @functions to add some functions
  • Use @inherits to specify different base class
demo razor
Demo - Razor
  • Resolve ambiguities
  • Create a unit test
  • Write inline template
nuget
NuGet
  • Consider following scenario
    • You want to install a library named X
    • X has a dependency on Y
    • You also want to install library named Z
    • Z has a dependency on Y
  • Need to think about:
    • Where can you get latest of all libraries?
    • What are the dependencies of each library?
    • Is it ok to use the latest release for Y?
    • If not, what happens if Z depends on a different version of Y than X?
nuget1
NuGet
  • A library package manager
  • Deals with packages rather than assemblies
  • An extension to Visual Studio 2010
  • Not just for ASP.NET MVC projects
  • Packages come from a well known repository
  • Automatically handling of version conflicts and updates
  • Once package is imported NuGet stays out of the way
  • No integration with TFS
nuget algorithm
NuGet Algorithm
  • Never installs assemblies at machine level
  • Uses bin deploy
  • Prefers unification over “side by side”
  • Always picks the lowest version of a dependency that fits in the range
  • Always move up to the highest build/revision
  • Can use the Add-BindingRedirect power shell command
demo nuget
Demo - NuGet
  • Install T4MVC
  • Install NHibernate
  • Handle conflicts
  • Get a list of updates available
  • Create a local repository
  • Give a look at http://nuget.org
iis express
IIS Express
  • Quick installation (less than 10MB)
  • Better support for IIS feature set
    • SSL
    • Integrated Mode
    • URL Re-Writing
    • Same configuration schema
  • Does not require administrator privileges
  • Doesn’t run as a service
  • Can co-exist with full IIS7.x and Cassini
  • Works on Windows XP SP3 and later
  • Supports multiple users on the same machine
  • Supports WCF but only over HTTP
  • Integrated into Visual Studio 2010 SP1 beta
demo iis express
Demo - IIS Express
  • Changing VS to work with IIS Express
  • Change VS default
  • Execute under Integrated Mode
  • Change application pool using AppCmd.exe
demo ef code first
Demo – EF Code First
  • Use DbContext
  • Change the database name
  • Use SQL CE
  • Dispose the context
  • Use validation
what s new in asp net mvc 3
What’s new in ASP.NET MVC 3?
  • Unobtrusive JavaScript
  • Posting JSON objects
  • Class level model validation
  • Partial page output caching
  • Better Dependency Injection
  • ViewBag
  • Global Filters
  • Sessionless Controller
asp net mvc vs asp net web forms
ASP.NET MVC vs. ASP.NET Web Forms
  • Both based on ASP.NET infrastructure
  • Same objectives, different ways
  • Both server centric
  • How sophisticated the UI need to be?
  • Are you planning for automation coverage?
  • What is your team developing background?
  • Can mix both in the same project
  • You can use ASP.NET Server Controls inside views (don’t tell anybody …)
summary
Summary
  • A different way to develop web applications
  • Razor Syntax – Clear & easier to maintain
  • NuGet – Integrate 3rd party libraries
  • IIS Express – IIS for the developer
  • Better Validation – Based on jQuery and Unobtrusive JavaScript principles
  • Many small enhancements
read more
Read more
  • Course 4282 at Hi-Tech College (Next Week!!!)
  • http://weblogs.asp.net/scottgu/
  • http://www.hanselman.com/blog/
  • http://www.asp.net/mvc
  • http://jquery.com/
ad