Reworking ASP.NET MVC Store with MVC# Framework
page 1 of 5
Published: 18 Jun 2008
Abstract
In this article Oleg examines how to rework an ASP.NET MVC application originally created by Scott Guthrie with the help of MVC# Framework. After a short introduction he provides a brief summary of the application being developed and provides exhaustive coverage of the various phases involved in the development with the help of relevant source code and screenshots.
by Oleg Zhukov
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 26115/ 68

Introduction

Not long ago Microsoft introduced their Model-View-Controller framework under ASP.NET MVC name. It provides a toolset for building well-designed testable 3-tier applications, which follow the Model-View-Controller pattern. However, MVC is not the only one architectural solution for constructing 3-tier applications. Another well known approach is the Model-View-Presenter pattern (abbreviated as "MVP"). MVP pattern appeared about 10 years after MVC originated. It was designed to be an evolution of MVC and to eliminate the drawbacks of the latter. And indeed, Model-View-Presenter has a number of advantages over MVC, which make MVP a more favorable choice than MVC for many applications.

In this article we are concerning a new Model-View-Presenter framework under .NET platform named MVC#. The article is based on the classic ASP.NET MVC example application by Scott Guthrie (described here: part 1, 2, 3, 4). But here we are going to re-implement this example with the use of MVC# Framework, showing the strong points of MVC# (and MVP pattern overall) over ASP.NET MVC.

A Simple Store Application

The ASP.NET MVC application we are going to rework consists of several views. We will deal with four of them: "Welcome" view, "Product Categories" view, "Products" view - to list products within a specific category, and "Edit Product" view to show/edit details for a chosen product.

If a user clicks on some category in the categories list he should be navigated to the products view for that category. If he clicks "Edit" against some product in the products view then the "Edit Product" view should be opened for that product. Finally, a user should be able to modify the product details (in the "Edit Product" view) and commit changes by clicking the "Save" button.

Figure 1

The Model is first

Model is the core of every application. It contains definitions for the application domain concepts, which the rest of the application relies on. That is why the applications' design is often started with constructing the model.

As for implementing the Model tier, several approaches are applicable here. A developer may use the conventional .NET 2.0 datasets, or more object-oriented brand new Linq + Entity Framework toolset, or third-party tools such as NHibernate or CapableObjects ECO. Anyway, neither ASP.NET MVC nor MVC# restrict developers in choosing the Model layer implementation technique.

Our example model will include three domain concepts: Categories, Suppliers and Products. The relationships between these concepts are quite simple: each product belongs to some category and some supplier. For maximum capability we will use typed datasets to implement the Model tier. So this is how our model will look in Visual Studio dataset designer:

Figure 2

To provide a uniform access to the Model objects we will also apply the Singleton pattern to the dataset class. As a result we will easily access domain objects through the NorthwindDataSet.Instance object.


View Entire Article

User Comments

No comments posted yet.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2014 ASPAlliance.com  |  Page Processed at 4/20/2014 4:45:35 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search