ASP.NET 外文翻译_第1页
ASP.NET 外文翻译_第2页
ASP.NET 外文翻译_第3页
ASP.NET 外文翻译_第4页
ASP.NET 外文翻译_第5页
已阅读5页,还剩5页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、中原工学院信息商务学院毕业设计(论文)译文专用纸外文部分asp.net mvc .net framework 4the model-view-controller (mvc) architectural pattern separates an application into three main components: the model, the view, and the controller.the asp.net mvc framework provides an alternative to the asp.net web forms pattern for creating w

2、eb applications.the asp.net mvc framework is a lightweight, highly testable presentation framework that (as with web forms-based applications) is integrated with existing asp.net features, such as master pages and membership-based authentication.the mvc framework is defined in thesystem.web.mvcassem

3、bly.mvc design patternmvc is a standard design pattern that many developers are familiar with.some types of web applications will benefit from the mvc framework.others will continue to use the traditional asp.net application pattern that is based on web forms and postbacks.other types of web applica

4、tions will combine the two approaches; neither approach excludes the other.the mvc framework includes the following components: models.model objects are the parts of the application that implement the logic for the applications data domain.often, model objects retrieve and store model state in a dat

5、abase.for example, aproductobject might retrieve information from a database, operate on it, and then write updated information back to a products table in a sql server database.in small applications, the model is often a conceptual separation instead of a physical one.for example, if the applicatio

6、n only reads a dataset and sends it to the view, the application does not have a physical model layer and associated classes.in that case, the dataset takes on the role of a model object. views.views are the components that display the applications user interface (ui).typically, this ui is created f

7、rom the model data.an example would be an edit view of a products table that displays text boxes, drop-down lists, and check boxes based on the current state of aproductobject. controllers.controllers are the components that handle user interaction, work with the model, and ultimately select a view

8、to render that displays ui.in an mvc application, the view only displays information; the controller handles and responds to user input and interaction.for example, the controller handles query-string values, and passes these values to the model, which in turn might use these values to query the dat

9、abase.the mvc pattern helps you create applications that separate the different aspects of the application (input logic, business logic, and ui logic), while providing a loose coupling between these elements.the pattern specifies where each kind of logic should be located in the application.the ui l

10、ogic belongs in the view.input logic belongs in the controller.business logic belongs in the model.this separation helps you manage complexity when you build an application, because it enables you to focus on one aspect of the implementation at a time.for example, you can focus on the view without d

11、epending on the business logic.the loose coupling between the three main components of an mvc application also promotes parallel development.for example, one developer can work on the view, a second developer can work on the controller logic, and a third developer can focus on the business logic in

12、the model.support for test-driven developmentin addition to managing complexity, the mvc pattern makes it easier to test applications than it is to test a web forms-based asp.net web application.for example, in a web forms-based asp.net web application, a single class is used both to display output

13、and to respond to user input.writing automated tests for web forms-based asp.net applications can be complex, because to test an individual page, you must instantiate the page class, all its child controls, and additional dependent classes in the application.because so many classes are instantiated

14、to run the page, it can be hard to write tests that focus exclusively on individual parts of the application.tests for web forms-based asp.net applications can therefore be more difficult to implement than tests in an mvc application.moreover, tests in a web forms-based asp.net application require a

15、 web server.the mvc framework decouples the components and makes heavy use of interfaces, which makes it possible to test individual components in isolation from the rest of the framework.when to create an mvc applicationyou must consider carefully whether to implement a web application by using eit

16、her the asp.net mvc framework or the asp.net web forms model.the mvc framework does not replace the web forms model; you can use either framework for web applications.(if you have existing web forms-based applications, these continue to work exactly as they always have.)before you decide to use the

17、mvc framework or the web forms model for a specific web site, weigh the advantages of each approach.advantages of an mvc-based web applicationthe asp.net mvc framework offers the following advantages: it makes it easier to manage complexity by dividing an application into the model, the view, and th

18、e controller. it does not use view state or server-based forms.this makes the mvc framework ideal for developers who want full control over the behavior of an application. it uses a front controller pattern that processes web application requests through a single controller.this enables you to desig

19、n an application that supports a rich routing infrastructure.for more information, seefront controller. it provides better support for test-driven development (tdd). it works well for web applications that are supported by large teams of developers and for web designers who need a high degree of con

20、trol over the application behavior.advantages of a web forms-based web applicationthe web forms-based framework offers the following advantages: it supports an event model that preserves state over http, which benefits line-of-business web application development.the web forms-based application prov

21、ides dozens of events that are supported in hundreds of server controls. it uses a page controller pattern that adds functionality to individual pages.for more information, seepage controller. it uses view state on server-based forms, which can make managing state information easier. it works well f

22、or small teams of web developers and designers who want to take advantage of the large number of components available for rapid application development. in general, it is less complex for application development, because the components (thepageclass, controls, and so on) are tightly integrated and u

23、sually require less code than the mvc model.features of the asp.net mvc frameworkthe asp.net mvc framework provides the following features: separation of application tasks (input logic, business logic, and ui logic), testability, and test-driven development (tdd).all core contracts in the mvc framew

24、ork are interface-based and can be tested by using mock objects, which are simulated objects that imitate the behavior of actual objects in the application.you can unit-test the application without having to run the controllers in an asp.net process, which makes unit testing fast and flexible.you ca

25、n use any unit-testing framework that is compatible with the .net framework. an extensible and pluggable framework.the components of the asp.net mvc framework are designed so that they can be easily replaced or customized.you can plug in your own view engine, url routing policy, action-method parame

26、ter serialization, and other components.the asp.net mvc framework also supports the use of dependency injection (di) and inversion of control (ioc) container models.di enables you to inject objects into a class, instead of relying on the class to create the object itself.ioc specifies that if an obj

27、ect requires another object, the first objects should get the second object from an outside source such as a configuration file.this makes testing easier. extensive support for asp.net routing, which is a powerful url-mapping component that lets you build applications that have comprehensible and se

28、archable urls.urls do not have to include file-name extensions, and are designed to support url naming patterns that work well for search engine optimization (seo) and representational state transfer (rest) addressing. support for using the markup in existing asp.net page (.aspx files), user control

29、 (.ascx files), and master page (.master files) markup files as view templates.you can use existing asp.net features with the asp.net mvc framework, such as nested master pages, in-line expressions (), declarative server controls, templates, data-binding, localization, and so on. support for existin

30、g asp.net features.asp.net mvc lets you use features such as forms authentication and windows authentication, url authorization, membership and roles, output and data caching, session and profile state management, health monitoring, the configuration system, and the provider architecture.中文部分asp.net

31、 mvc 在订餐系统的作用.net framework 4模型-视图-控制器 (mvc) 体系结构模式将应用程序分成三个主要组件:模型、视图和控制器。asp.net mvc 框架提供用于创建 web 应用程序的 asp.net web 窗体模式的替代模式。asp.net mvc 框架是一个可测试性非常高的轻型演示框架,(与基于 web 窗体的应用程序一样)它集成了现有的 asp.net 功能,如母版页和基于成员资格的身份验证。mvc 框架在system.web.mvc程序集中定义。mvc 设计模式mvc 是许多开发人员熟悉的标准设计模式。一些类型的 web 应用程序将得益于 mvc 框架。一些

32、类型将继续使用基于 web 窗体和回发的传统 asp.net 应用程序模式。其他类型的 web 应用程序将结合这两种方法;这两种方法彼此互不包含。mvc 框架包括以下组件: 模型。模型对象是实现应用程序数据域逻辑的应用程序部件。通常,模型对象会检索模型状态并将其存储在数据库中。例如,product对象可能会从数据库中检索信息,操作该信息,然后将更新的信息写回到 sql server 数据库内的 products 表中。在小型应用程序中,模型通常是概念上的分离,而不是实际分离。例如,如果应用程序仅读取数据集并将其发送到视图,则该应用程序没有物理模型层和关联的类。在这种情况下,数据集担当模型对象的

33、作用。 视图。视图是显示应用程序用户界面 (ui) 的组件。通常,此 ui 是用模型数据创建的。products 表的编辑视图便是一个视图示例,该视图基于product对象的当前状态显示文本框、下拉列表和复选框。 控制器。控制器是处理用户交互、使用模型并最终选择要呈现的视图来显示 ui 的组件。在 mvc 应用程序中,视图仅显示信息;控制器则用于处理和响应用户输入和交互。例如,控制器处理查询字符串值,并将这些值传递给模型,而模型可能会使用这些值来查询数据库。mvc 模式可以帮助您创建使应用程序的不同方面(输入逻辑、业务逻辑和 ui 逻辑)分离的应用程序,同时可在这些元素之间提供松散耦合。该模式

34、指定每种逻辑在应用程序中应处的位置。ui 逻辑位于视图中。输入逻辑位于控制器中。业务逻辑位于模型中。在您生成应用程序时,通过使用这种分离方式,可以帮助您化繁为简,因为它可以使您侧重于一次实现应用程序的一个方面。例如,您可以侧重于独立于业务逻辑的视图。mvc 应用程序的这三个主要组件之间的松散耦合也可促进并行开发。例如,一个开发人员可以从事视图方面的工作,第二个开发人员可以从事控制器逻辑方面的工作,第三个开发人员可以侧重于模型中的业务逻辑。对测试驱动的开发的支持使用 mvc 模式除了可以化繁为简外,还可以使应用程序的测试工作比基于 web 窗体的 asp.net web 应用程序的测试工作更加轻

35、松。例如,在基于 web 窗体的 asp.net web 应用程序中,单一类既用于显示输出又用于响应用户输入。为基于 web 窗体的 asp.net 应用程序编写自动化测试可能是一项复杂的工作,因为若要测试单个页面,您必须实例化应用程序中的页类、其所有子控件以及其他相关类。因为为运行页面而实例化的类如此之多,所以可能难以编写专门侧重于应用程序单个部件的测试。因此,与 mvc 应用程序测试相比,基于 web 窗体的 asp.net 应用程序的测试更加难以实现。而且,基于 web 窗体的 asp.net 应用程序的测试需要 web 服务器。mvc 框架可使组件分离并大量使用接口,这样,便可以将单个

36、组件与框架的其余部分分开进行测试。何时创建 mvc 应用程序您必须仔细考虑是使用 asp.net mvc 框架还是使用 asp.net web 窗体模型来实现 web 应用程序。mvc 框架未取代 web 窗体模型;您可以对 web 应用程序使用任一框架。(如果您具有现有的基于 web 窗体的应用程序,则这些应用程序将完全按照它们一贯的方式继续工作。)在决定对特定网站使用 mvc 框架或 web 窗体模型之前,请权衡各种方法的优点。基于 mvc 的 web 应用程序的优点asp.net mvc 框架具有以下优点: 通过将应用程序分为模型、视图和控制器,化繁为简的工作更加轻松。 它不使用视图状态或基于服务器的窗体。这使得 mvc 框架特别适合想要完全控制应用程序行为的开发人员。 它使用一种通过单一控制器处理 web 应用程序请求的前端控制器模式。这使您可以设计一个支持丰富路由基础结构的应用程序。有关更多信息,请参见front controller(前端控制器)。 它为测试驱动的开发 (tdd) 提供了更好的支持。 它非常适合大型开发人员团队支持的 web 应用程序,以及需要对应用程序行为进行极度控制的 web 设计人员。基于 web 窗体的

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论