锐英源软件
第一信赖

精通

英语

开源

擅长

开发

培训

胸怀四海 

第一信赖

当前位置:锐英源 / 英语翻译 / ASP.NET的MVC中级引导英语翻译英文原文
服务方向
人工智能数据处理
人工智能培训
kaldi数据准备
小语种语音识别
语音识别标注
语音识别系统
语音识别转文字
kaldi开发技术服务
软件开发
运动控制卡上位机
机械加工软件
软件开发培训
Java 安卓移动开发
VC++
C#软件
汇编和破解
驱动开发
联系方式
固话:0371-63888850
手机:138-0381-0136
Q Q:396806883
微信:ryysoft

中文译文

 

锐英源精品开源心得,转载请注明:“锐英源www.wisestudy.cn,孙老师作品,电话13803810136。”需要全文内容也请联系孙老师。

This article gives a simple tutorial on developing ASP.NET applications in MVC pattern.

One of the recent developments in ASP.NET is the MVC (Model–View–Controller) design pattern. MVC pattern isolates the application logic for the users from input and presentation (GUI).
According to Scott Guthrie, MVC pattern has the following advantages:

  • One of the benefits of using a MVC methodology is that it helps enforce a clean separation of concerns between the models, views and controllers within an application. Maintaining a clean separation of concerns makes the testing of applications much easier, since the contract between different application components are more clearly defined and articulated.
  • The MVC pattern can also help enable red/green test driven development (TDD) - where you implement automated unit tests, which define and verify the requirements of new code, first before you actually write the code itself.

The following picture borrowed from Wikipedia shows the MVC pattern:
MVCDiagram.jpg
MVC divides an application into three concerns:

  • Model - Encapsulates core application data and functionality Domain Logic.
  • View - obtains data from the model and presents it to the user.
  • Controller - receives and translates input to requests on the model or the view.

Scott Guthrie gave a very good and detailed introduction on applying MVC pattern to ASP.NET projects in his blog. For obvious reasons, his introduction is very comprehensive and authoritative. It should be the first reference for application developers who want to understand ASP.NET MVC.
This article is intended to give a simpler tutorial on developing ASP.NET MVC applications in the Microsoft Visual Studio context to help application developers to get a quick start.
When working on ASP.NET MVC web sites, the first thing you may notice is that the URLs to access the web pages are no longer the familiar "http://www.codeproject.com/info/search.aspx" style. Instead the URLs will look likehttp://localhost/VirtualDirectoryName/Controller/Action.
After reading this article, hopefully you will be able to quickly develop your own ASP.NET MVC web applications in Visual Studio. The article is intended to answer the following questions:

  • How are the ASP.NET MVC URLs associated to the resources on the web server?
  • In ASP.NET, what are the Models, Views, and Controllers and how are they implemented?
  • How is information passed among the Models, Views, and Controllers?
  • How does the application code on the server access the data passed to the server by URL parameters and form submissions from the browser?
  • How to access the session data in ASP.NET MVC?
  • How to use code behind when implementing the Views?

This tutorial application is developed in Visual Studio 2008, and the language used is C#. If you have Visual Studio 2010, your environment may be different.
This article comes with the source code for this tutorial. It may be a good idea if you download the source code and run it in your Visual Studio before you start to read this tutorial. This should give you a better idea on the functions implemented in this simple tutorial ASP.NET MVC application. This should make your reading of this article easier. If you are unable to load the source code in your Visual Studio, you may need to first set up your development environment.
Let us begin the tutorial by first setting up our development environment.

Set up the Development Environment

In order to develop MVC ASP.NET applications, you will need to install the Visual Studio ASP.NET MVC Add-on. If you have not done so, you can go to the Microsoft web site to download the Add-on and install it on your computer.

Create an Empty MVC ASP.NET Project in Visual Studio

fter installing the ASP.NET MVC Add-on, we can start to create an ASP.NET MVC project in Visual Studio.

CreateEmptyProject.jpg
We can create two types of ASP.NET MVC applications. In this tutorial, we will create an "ASP.NET MVC 2 Empty Web Application". Give the project the name "ASPNetMVCTutorial" and browse a folder where you want to save the files that the Visual Studio will be generating and click the "OK" button.
After the project is created, the solution explorer will have the following contents:

SolutionExplorerBeforeCleaning.jpg
In order to better focus on the MVC pattern in this ASP.NET development, I will be limiting the use of JavaScripts, and CSS style sheets. Let us delete the folders that are not MVC related and add a folder called "Utilities". The "Utilities" folder will be later used to add some utility classes to the project. After the cleaning, the solution explorer will have the following contents:

SolutionExplorerAfterCleaningUtil.jpg

友情链接
版权所有 Copyright(c)2004-2024 锐英源软件
统一社会信用代码:91410105098562502G 豫ICP备08007559号 最佳分辨率 1440*900
地址:郑州市金水区文化路97号郑州大学北区院内南门附近