asp.net MVC framework (first part)

Source: Internet
Author: User
Tags commerce store visual studio

A simple e-commerce store application

I'll use a simple ecommerce store application to demonstrate how the asp.net MVC framework works. In today's post, I will implement a product list, as well as related browsing application scenarios.

Specifically, we will build an online store that allows users to browse the product Category list when they visit the/products/categories URL on the site:

When the user clicks on the Product category link on the above page, they will go to a product Category List Url/products/list/categoryname, which lists the products that are still being sold in the specified category:

When users click on individual products, they will go to the product Details Url/products/detail/productid, this page will show the user selected products more details:

We will use the new ASP.net MVC framework to implement all of these features. This will allow us to maintain a "clear separation of concerns" between the different components of the application, allowing us to integrate unit testing and test-driven development more easily.

Create a new asp.net MVC application

The ASP.net MVC framework contains a Visual Studio project template that makes it easy for you to create new MVC Web applications. Select the file-> new Item menu, select the "ASP.net MVC Web Application" template, and use it to create a new Web application.

By default, when you use this option to generate a new application, Visual Studio creates a new solution for you and then adds 2 projects to it. The first project is a Web project in which you implement the functionality of your Web application. The second project is a test project where you can write unit tests to test your application code:

You can use any of the unit test frameworks in the ASP.net MVC framework, including NUnit, Mbunit, MSTest, Xunit, and other frameworks. The VS 2008 Professional Edition now includes support for MSTest's built-in test projects (VS 2005 version of MSTest requires you to have the Visual Studio Team System version to use), and when you use VS 2008, the default ASP.net MVC The project module automatically generates such a test project.

We will also publish project templates that can be used with NUnit, Mbunit, and other unit test frameworks, so if you prefer those frameworks, you can easily click on them to generate your application and the corresponding test project that can be used immediately.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.