In this unit, we'll cover the enhancements to ASP.NET in the .NET Framework 4. You'll
learn about changes to WebForms, AJAX and Dynamic Data and you'll get introduced to ASP.NET MVC, now
included in the framework.
In this lab, you'll look at several of the new web development features in Visual Studio 2010.
You'll see how HTML code snippets speeds up the development of web applications. Visual Studio 2010 also
makes it easier to manage multiple Web.config files for the various deployment environments of your
web application. Finally, you'll see how Visual Studio 2010 integrates with the Microsoft Web Deployment tool
to automate the packaging and deployment of your application and its dependencies.
This 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.
In ASP.NET MVC Models and Data Access Hand-on Lab, you have been loading data from the database and displaying it. In this Hands-on Lab, you will add to the Music Store application, the ability to edit that data.
This Hands-on Lab will show you how to use the free SQL Server Express as a database engine in order to store and retrieve the data needed for the Music Store application. To accomplish that, you will start with an already created database, from which you will generate the Entity Data Model you will use in the application.
ASP.NET MVC 3 introduces the new view engine Razor, which was conceived to simplify the current syntax used in ASP.NET web pages. In this lab you will learn how to create Razor views inside an MVC solution.
In the beginning of this Lab you will first get familiar with Razor syntax and its features: general rules, code blocks, inline HTML and layout pages. Once you have learned the basics, in Exercise 2 you will add Razor views in the MVC Music Store solution to provide the same functionality you have in ASP.NET views, but with a clearer and reduced code.
At the end of this lab, in Exercise 3, you will learn how to create and consume third party Razor Helpers.
In ASP.NET MVC 3 Global, Dynamic Filters Hands-on Lab, you have been adding filters to MVC processing. In this Hands-on Lab, you will use custom filters to log your site activity.
To achieve that, in the proposed exercise you will create a custom filter attribute that will work with any specified controller. That filter will catch controller's requests, and save them into a database table. Through a log view you will be able to see the list of visits that each filtered controller had.
In ASP.NET MVC Helpers, Forms and Validation Hands-on Lab , you have been validating data from the create and edit album forms. In this Hands-on Lab, you will use custom validation logic to control price range in the server side as well as in the client.
In order to achieve that, in the first exercise you will create a custom validation property attribute and then add it to the Album model. The existing create and edit views in the StoreManager controller will process the new custom validation from the server side.
In Object Oriented Programming paradigm, objects work together in a collaboration model where there are contributors and consumers. Naturally, this communication model generates dependencies between objects and components that could became difficult to manage when complexity increases .
You have probably heard about Factory Pattern and the separation between the interface and the implementation using services. However, the client objects are often responsible for service location.
Before introducing the Dependency Injection Pattern, we will explain what Inversion of Control (IoC) principle is.
With Inversion of Control (Ioc), consumer objects do not create the other objects on which they rely. Those objects come from an external source.
ASP.NET MVC provides action filters for performing logic either before an action method is called or after its run. Action Filters are custom attributes that provide a declarative means to add pre-action and post-action behavior to controller action methods.
In previous versions of MVC, action filters were applied by making a filter attribute and apply it to a controller or an action method. MVC 3 provides the ability to define filters outside that scope, giving the possibility to apply filters to all actions in an MVC application.
In ASP.NET MVC 2 Membership, Authorization and Store Checkout you have been working with the security of your web application. In this Hands-on Lab you will use Global Filters and will apply them to site logging. In order to achieve that, in the first exercise you will learn how to use the filters and how to customize an Attribute filter for global security. Then, in the second exercise you will learn how to create a Global Dynamic Filter by using MVC Filter Providers. That consists in a filter in which execution depends on the context.
With .NET you can develop class libraries, web projects, complete solutions, frameworks, application servers, web controls and helpers, etc. A live ecosystem of such packages (many of them open source projects) is available for you to download from the Internet and add to your own solutions. You can also create your own library and publish it in your server. Nevertheless, this model implies some costs: you should locate the appropriate software, download and compile it, resolve dependencies of other packages, etc.
With NuGet (http://nuget.codeplex.com) tool, you can download, create, and publish software packages, ready to be used by other developers, resolving the hassles of dependencies tracking. You can use a console tool to create a new package, upload it to a Microsoft server or to a server of your own, browse and install them from Visual Studio.
Testing an application is an automated way of verifying it is always behaving the way it is supposed to. That way, you can later make changes to the code and refactor components without breaking something else somewhere in the application.This Lab will take you through the process of testing controllers in an ASP.NET MVC application, used to verify that actions are working properly.
In this Hands-on Lab, each test is independent from the others, but instead of stubs or mocks, you will be testing the controllers against a well-known database. If needed, that database will be protected by transactions and its initial state will be copied for each test execution, making sure that each test runs with a controlled data set.