ASP .NET MVC Framework简介
An Introduction to ASP .NET MVC Framework According to Scott Guthrie at Microsoft, "MVC is a framework methodology that divides an application's implementation into three component roles: models, views, and controllers.
在一个MVC构架的应用程序里,模型负责维护状态。 通常情况下,这个状态被保存在数据库中(例如:我们可能通过一个Product类来再现保存在SQL数据库内Products表中的数据。
"视图"在一个MVC构架的应用里负责展示整个应用的用户界面。Typically this UI is created off of the model data (例如:我们依照一个Product对象的状态创建一个由文本框、下拉框和复选框组成的视图)
控制器在一个MVC构架的应用里负责处理用户交互,操纵模型并且最终选择一个视图将结果呈现给用户。在一个MVC程序中视图仅负责呈现信息-处理和相应用户的输入和交互是控制器的职责。 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." This tutorial covers an introduction to the MVC pattern using Visual Basic. It shows you want software is needed to work with the model. It also includes a brief overview of the URL routing assumptions that are a foundation to the implementation of the pattern. Finally, a sample application is created to demonstrate the fundamentals of this new web-application model. |