Aspnet mvc

  • 2,269 views
Uploaded on

ASP.NET MVC

ASP.NET MVC

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
2,269
On Slideshare
0
From Embeds
0
Number of Embeds
2

Actions

Shares
Downloads
72
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Head First ASP.Net MVC 2.0 Zhiming Jiang MSN GMD Integration
  • 2. TOPIC• Review• Getting started with ASP.NET MVC• Understanding ASP.NET MVC• Customizing and Extending• Best Practices• MVC 2.0 New Features
  • 3. The way of ASP.NET MVCREVIEW
  • 4. The Downside of ASP.NET• Very complex page pipeline engine• Difficult to maintain• Impossible to test – Difficulty partially arises from simulating Context, Request, Response, and Session objects.• The cryptic control ids and sensitivities of ViewState• Overly mix business and presentation logic• Event-driven model
  • 5. Innovation!
  • 6. MVC Framework History1970S 2003 RoR Based on Python …. 2009.3 MVC1 2010.4 MVC2
  • 7. ASP.NET MVC IS……• New ASP.NET application development style – Another is“ASP.NET Web Form” – Fill the gaps of ASP.NET Web Form• New choice• Full control over URLs• Full control over HTML• Easier to test (TDD)• Flexible, extendable, easily replaced
  • 8. ASP.NET MVC IS NOT……• The substitute of 3-tier structure• ASP.NET Web Form’s substitute• ASP.NET Web Form promotion version – ASP.NET Web Form 4.0• Fit RAD• Fit every project• Fit everyone
  • 9. Different Between with Web Form Classic Web Form ASP.NET MVC Postback REST, HTML Post Code behind Separate controller Single form Multiple forms Server controls HTML Helpers Page and control lifecycle Controller
  • 10. ASP.NET MVC 101GETTING STARTED WITH ASP.NETMVC
  • 11. ASP.NET MVC Framework Structure ASP.NET Abstractions (System.Web.Abstractions.dll) ASP.NET Routing (System.Web.Routing.dll) ASP.NET MVC (System.Web.Mvc.dll)
  • 12. But what is the work process?但是具体的流程是什么样?
  • 13. Classic Application Architecture MvcDemo.Web.UIPresentatio MvcDemo.Modelsn MvcDemo.Web.ControllersBiz MvcDemo.BusinessServiceDataAccess MvcDemo.DataResponsity
  • 14. ASP.NET MVC Excute Process
  • 15. Understanding Models, Views, and ControllersUNDERSTANDING ASP.NET MVC
  • 16. ASP.NET Routing• URL Patterns• Setting Default Values for URL Parameters• Adding Constraints to Routes• Scenarios When Routing Is Not Applied• How URLs Are Matched to Routes• Accessing URL Parameters in a Routed Page• ASP.NET Routing and Security• ASP.NET Routing versus URL Rewriting
  • 17. Working with Models• What’s Model• Validation
  • 18. Controllers & Action• Receiving input – QueryString, Request.Form, FormCollection, Custome(IModelBinding)• Filter• Aysnc action• Producing output – Action Result, View Data, View Model• How defines – End with the word Controller – Inherit from System.Web.Mvc.Controller (or implement Icontroller – Contain public methods that return ActionResult
  • 19. Filtering Action Methods
  • 20. Working with Views• View Engine• View Page• View Data• View Helper• Form Post• Using MasterPage• Order
  • 21. MVC Custom and ExtensionsCUSTOMIZING AND EXTENDING
  • 22. Customizing & Extending• Extending URL Routing• Customer ControllerFactory• Extending Controller & Action• Custom View Engine• T4 Template
  • 23. Truth in PracticeBEST PRACTICES
  • 24. Best Practices Securing MVC applications Dependency Injection of Controllers Using RESTful Architecture Handling errors in MVC applications Unit Test & MVC Mock Helpers Using AJAX in ASP.NET MVC applications Improving ASP.NET MVC application performance Localizing ASP.NET MVC Validation Deploying MVC applications
  • 25. Areas, Async Controllers Support, Scaffold …MVC 2.0 NEW FEATURES
  • 26. • New Strongly Typed HTML Helpers• Enhanced Model Validation support across both server and client• Auto-Scaffold UI Helpers with Template Customization• Support for splitting up large applications into “Areas”• Asynchronous Controllers support that enables long running tasks in parallel• Support for rendering sub-sections of a page/site using Html.RenderAction• Lots of new helper functions, utilities, and API enhancements• Improved Visual Studio tooling support
  • 27. Areas• Introduction – Organizing our projects hierarchically into folders and namespaces• Building a portable area• Embedding Views• Distributing a portable area
  • 28. Async Controllers Support• Change the way of request handling• Decide whether the action is async or not• Execute an action• ModelBinder support• Limitations and drawbacks
  • 29. http://nerddinner.codeplex.com/ [Video]Creating NerdDinner.com with MVC Oxite 2: An official CMS Product MvcContrib: a Codeplex Foundation Project http://mvccontrib.codeplex.com/ http://tailspintravel.codeplex.com http://mvcsitemap.codeplex.com/ http://mvcmembership.codeplex.com/ http://code.msdn.microsoft.com/aspnetmvcsamplesNice projects to learn MVCRECOURSE
  • 30. Please fill out the session evaluation form provided and drop it off with the staff at the exit.Your Feedback is Important!IT IS OVER,THANKS