打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
MVC

Models: Model objects are theparts of the application that implement the logic for the application’s datadomain. Often, model objects retrieve and store model state in a database. Forexample, a Product object might retrieve information from a database, operateon it, and then write updated information back to a Products table in SQLServer.

 

Views: Viewsare the components that display the application’s user interface(UI).Typically, this UI is created from the model data. An example would be an editview of a Products table that displays text boxes, drop-down lists, and checkboxes based on the current state of a Products object.

 

Controllers: Controllers are thecomponents that handle user interaction, work with the model, and ultimatelyselect a view to render that displays UI. In an MVC application, the view onlydisplays information; the controller handles and responds to user input andinteraction. For example, the controller handles query-string values, andpasses these values to the model, which in turn queries the database by usingthe values.

 

MVC & ASP.NET Web Forms

You must consider carefully whether toimplement a Web application by using either the ASP.NET MVC framework or theASP.NET Web Forms model. The MVC framework does not replace the Web Formsmodel; you can use either framework for Web applications.(If you have existingWeb Form-based applications, these continue to work exactly as they alwayshave.)

 

Features of the ASP.NET MVC Framework

TheASP.NET MVC framework provides the following features:

l        Separtion of applicationtasks(input logic, business logic and UI logic), testability, and test-drivendevelopment(TDD) by default. All core contracts in the MVC framework areinterface-based and can be tested by using mock objects, which are simulatedobjects that imitate the behavior of actual objects in the application. You canunit-test the application without having to run the controllers in an ASP.NETprocess, which makes unit testing fast and flexible. You can use anyunit-testing framework that is compatible with the .NET Framework.

l        An extensible and pluggableframework. The components of the ASP.NET MVC framework are designed so thatthey can be easily replaced or customized. You can plug in your own viewengine, URL routing policy, action-method parameter serialization, and othercomponents. You can plug in your own view engine, URL routing policy,action-method parameter serialization, and other components. The ASP.NET MVCframework also supports the use of Dependency Injection(DI) and Inversion ofControl(IOC) container models. DI allows you to inject objects into a class ,instead of relying on the class to create the object it self. IOC specifiesthat if an object requires another object, the first objects should get thesecond object from an outside source such as a configuration file. This makestesting easier.

l        A powerful URL-mappingcomponent that lets you build applications that have comprehensible andsearchable URLs. URLs do not have to include file-name extensions, and are designedto support URL naming patterns that work well for search engineoptimization(SEO) and representational state transfer(REST) addressing.

l        Support for using the markup inexisting ASP.NET page (.aspx files), user control(.ascx files), and masterpage(.master files) markup files as view templates. You can use existingASP.NET features with the ASP.NET MVC framework, such as nested master pages,in-line expression(<%=%>),declarative server controls,templates,data-bingding, localization, and so on.

l        Support for existing ASP.NETfeatures. ASP.NET MVC lets you use features such as forms authentication andWindow authentication, URL authorization, membership and roles, output and datacaching, session and profile state management, health monitoring, the configurationsystem, and the provider architecture.

 

 

参考:MSDN MVC部分

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
ASP .NET MVC 之Entity Framework
学习ASP.NET MVC的基本概念
学习 ASP.NET MVC (第三回)实战篇
.NET和J2EE该相互学习什么
ASP.NET MVC随想录(1):漫谈OWIN
ASP.NET MVC随想录——锋利的KATANA
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服