1 / 13

ASP.NET MVC

ASP.NET MVC. An Introduction. What is MVC. The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the

eweaver
Download Presentation

ASP.NET MVC

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ASP.NET MVC An Introduction

  2. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components: the model, the view, and the controller. The ASP.NET MVC framework provides an alternative to the ASP.NET Web Forms pattern for creating MVC-based Web applications. The ASP.NET MVC framework is a lightweight, highly testable presentation framework that (as with Web Forms-based applications) is integrated with existing ASP.NET features, such as master pages and membership-based authentication. The MVC framework is defined in the System.Web.Mvc namespace and is a fundamental, supported part of the System.Web namespace. Cont....

  3. ASP.NET Webforms Pros • Robust foundation • Can scale well • Drag and Drop for speed • Easy to get started • Very large user base

  4. ASP.NET Webforms Cons • Viewstate makes pages heavy • Very complex page life cycle • 3 ID fields (ID, ClientID, UniqueID)‏ • Business logic tends to end up in codebehind • No Applications structure guidance • View and Controller are mushed together

  5. Why ASP.NET MVC • Easier to test without IIS • Page life cycle is greatly simplified • Builds on top of ASP.NET • Caching • Authentication • Master Pages • Viewstate is gone • Cleaner urls by default

  6. Model Domain objects

  7. Model Model objects are the parts of the application that implement the logic for the application's data domain. Often, model objects retrieve and store model state in a database. For example, a Product object might retrieve information from a database, operate on it, and then write updated information back to a Products table in SQL Server.

  8. View Transforms objects to presentation

  9. View • Should be relatively “dumb” • No business logic • Only Display logic / Transformation • JavaScript is valid for client side - jQuery

  10. Controller Well, it’s in control

  11. Controller • Controller has ‘Actions’ • Decides what data is needed • Tells which View to render • Tells the View what to render • The view only displays information, the controller handles and responds to user input and interaction.

  12. Webforms vs MVC • ASP.Net Webforms • faster starting point • drag and drop • ASP.NET MVC • Unnecessary abstractions are gone • Easier to Unit Test components • Can write bad or good code in both • Either can be complex or simple

  13. Thank you

More Related