ASP.NET MVC 3 FundamentalsVersion: 1.1.0 DescriptionThis Hands-On Lab is based on MVC (Model View Controller) Music Store, a tutorial application that introduces and explains step-by-step how to use ASP.NET MVC and Visual Web Developer 2010 Express (which is free). Throughout the lab you will learn the simplicity, yet power of using these technologies together. You will start with a simple application and will build it until you have a fully functional MVC Web Application. OverviewThis Hands-On Lab is based on MVC (Model View Controller) Music Store, a tutorial application that introduces and explains step-by-step how to use ASP.NET MVC and Visual Web Developer 2010 Express (which is free). Throughout the lab you will learn the simplicity, yet power of using these technologies together. You will start with a simple application and will build it until you have a fully functional MVC Web Application. This Lab will work with ASP.NET MVC 3 and it uses new features as dynamic properties in views. If you wish to explore the ASP.NET MVC 2 version of the tutorial application, you will find it in https://mvcmusicstore.codeplex.com/.
Note:
This Hands-On Lab assumes that the developer has basic experience with Web Development and technologies such as HTML and JavaScript.
Before diving into ASP.NET MVC, if you would like more context on the ASP.NET 4 stack – watch this short video where Jonathan Carter takes us through what’s new in ASP.NET 4.
The Music Store applicationThe Music Store web application to be built throughout this Lab comprises three main parts: shopping, checkout, and administration. Visitors will be able to browse albums by genre, add albums to their cart, review their selection and finally proceed to checkout to login and complete the order. Additionally, store administrators will be able to manage the store’s available albums as well as their main properties.
Figure 1
Music Store screens MVC EssentialsMusic Store application will be built using Model View Controller (MVC), an architectural pattern that separates an application into three main components:
The MVC pattern helps you to create applications that separate the different aspects of the application (input logic, business logic, and UI logic), while providing a loose coupling between these elements. This separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time. In addition to managing complexity, the MVC pattern makes it easier to test applications than it is to test a traditional ASP.NET Web application, encouraging the use of test-driven development (TDD) for creating an applications. Then, 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 so you get all the power of the core .NET framework. This is useful if you are already familiar with ASP.NET Web Forms because all of the libraries that you already use are available to you in ASP.NET MVC as well. In addition, the loose coupling between the three main components of an MVC application also promotes parallel development. For instance, one developer can work on the view, a second developer can work on the controller logic, and a third developer can focus on the business logic in the model. ObjectivesIn this Hands-On Lab, you will learn how to:
System RequirementsYou must have the following items to complete this lab:
SetupInstalling Code SnippetsFor convenience, much of the code you will be managing along this lab is available as Visual Studio code snippets. To install the code snippets run .\Source\Assets\CodeSnippets.vsi file. Installing Web Platform InstallerThis section assumes that you don’t have some or all the system requirements installed. In case you do, you can simply skip this section. Microsoft Web Platform Installer (WebPI) is a tool that manages the installation of the prerequisites for this Lab.
Note:
As well as the Microsoft Web Platform, WebPI can also install many of the open source applications that are available like Umbraco, Kentico, DotNetNuke and many more. These are very useful for providing a foundation from which to customize an application to your requirements, dramatically cutting down your development time.
Please follow these steps to downloads and install Microsoft Visual Studio 2010 Express Edition and SQL Server 2008 Express Edition:
Running Web Platform Installer to install Lab prerequisites
ExercisesThis Hands-On Lab is comprised by the following exercises:
Estimated time to complete this lab: 45 minutes.
Note:
Each exercise is accompanied by an End folder containing the resulting solution you should obtain after completing the exercises. You can use this solution as a guide if you need additional help working through the exercises.
Next StepExercise 1: Creating MusicStore ASP.NET MVC Web Application Project |