Download presentation
Presentation is loading. Please wait.
Published byGervase Dawson Modified over 9 years ago
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
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.