Your SlideShare is downloading. ×
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Mvc 4 0_jayant_jindal_28082010
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Mvc 4 0_jayant_jindal_28082010

1,013

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
1,013
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
30
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. MVC ASP .Net VS 2010
    Jayant Jindal
    jayantjindal@hotmail.com
  • 2. Key Take Aways…
    Why MVC?
    What is MVC?
    How to Implement MVC?
    ASP .Net VS 2010 MVC Enhancements…
  • 3. Why MVC?
    Easier code maintenance and support.
    Supports automated unit testing tools such as NUnit, MBUnit,...
    Decouple business and presentation application layers.
    Web-based thin-client application.
    User interface logic tends to change more frequently than business logic.
  • 4. Patterns…
    Page Controller Pattern
    • ASP.NET web forms are the code-behind classes.
    • 5. Each page has a code-behind class.
    • 6. URL requested by the client is directly handled by individual pages.
    • 7. All page code is in the code-behind files.
    • 8. By default, ASP.NET is page controller based.
  • Patterns…
    • Front Controller Pattern
    • 9. MVC is based on a front controller design.
    • 10. Centralized controller instead of multiple controllers.
    • 11. Trap all client requests, and controller decides which view or .aspx to render.
    Client Request
    Central Controller
    MyPage2 ASPX
    HTML View
    MyPage1 ASPX
    HTML View
  • 12. What is MVC?
    • Model: This refers to the data that is shown in the UI. Data can come from different sources.
    • 13. View: This refers to the UI components that will show the model data.
    Controller: This controls when to change the view, based on user actions.
    MVC design is not a replacement to the n-tier architecture.
    The model, the view, and the controller are not related directly to the layers, or to the physical tiers; they are logical components that operate together in a certain pattern.
  • 14. Basics of MVC
    • Model is independent of the view and the controller.
    Controller is associated with the view, allowing to change views independent of the controller.
    View depends on the model, and is updated when the model's state has changed.
    Controller
    View
    Model
  • 15. REST: Representation State Transfer
    Architectural pattern used to identify and fetch resources from networked systems. e.g. www.
    Sharing of resources via unique identifiers.
    No need to check for a page postback.
    Foll. code is not supported in REST approach:
    btnSave_Cick()
    {
    Response.Redirect("~/MyPage.aspx");
    }
  • 16. ASP.NET MVC Framework
    In MVC framework, URL routing is used.
    URLs are used based on the settings in a config file. e.g.: http://localhost/customer/list/ instead of traditional URL like: http://localhost/CustomerList.aspx
    ASPX pages are kind of view engine, nothing else.
    ASP.NET MVC framework is not a replacement or upgrade of web forms, but merely another way of programming.
  • 17. URL Routing Engine
    • Standard ASP.NET model
    • 18. MVC Framework model:
    CustomerList.aspx processed by ASP.NET runtime and HTML returned to IIS
    Client browser requests URL
    http://myapp/CustomerList.aspx
    IIS
    Client browser requests URL
    http://myapp/Customer/List
    ASP.NET runtime
    IIS
    Controller Class
    Model Class
    View (ASPX)
  • 19. MVC 2.0 Enhancements
    Includes ASP.NET MVC 2 framework.
    Strongly Typed Html Helpers: view model level error instead of all validation Errors
    ASP.NET MVC 1 : <%= Html.TextBox(“ClassId”, Model.ClassId) %>
    ASP.NET MVC 2 : <%= Html.TextBoxFor(model => model.ClassId) %>
    Model Validation: Validation logic is always enforced on the server, and if needed can be done on client via JavaScript.
  • 20. MVC 2.0 Framework Enhancements
    Areas Support:Group controllers and views into sections.
    Data-Annotation Attribute Validation Support: Enable to perform validation by adding one or more attributes. (Add References: Microsoft.Web.Mvc.DataAnnotations.dll and System.ComponentModel.DataAnnotations.dll assemblies. E.g.:
  • 21. MVC 2.0 Framework Enhancements
    using System.ComponentModel;
    Using System.ComponentModel.DataAnnotations;
    namespace MvcApplication1.Models
    {public class Product
    {public int Id { get; set; }
    [Required]
    [StringLength(10)]
    public string Name { get; set; }
    [DisplayName("Price")]
    [Required]
    [RegularExpression(@"^$?d+(.(d{2}))?$")]
    public decimal UnitPrice { get; set; } }}
  • 22. Suggested Reading…
    • ASP.Net 3.5 (Application Architecture and Design) by Vivek Thakur
  • Thank You
    Questions
    ???
    Contact me:
    jayantjindal@hotmail.com

×