现在的位置: 首页 > 综合 > 正文

MVC

2013年10月06日 ⁄ 综合 ⁄ 共 3355字 ⁄ 字号 评论关闭

Models:

Model objects are the
parts of the application that implement the logic for the application’s data
domain. Often, model objects retrieve and store model state in a database. For
example, a Product object might retrieve information from a database, operate
on it, and then write updated information back to a Products table in SQL
Server.

 

Views:


Views
are the components that display the application’s user interface(UI).
Typically, this UI is created from 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 a Products object.

 

Controllers:

Controllers are the
components that handle user interaction, work with the model, and ultimately
select a view 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 queries the database by using
the values.

 

MVC & ASP.NET Web Forms

You must consider carefully whether to
implement a Web application by using either 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 Form-based applications, these continue to work exactly as they always
have.)

 

Features of the ASP.NET MVC Framework

The
ASP.NET MVC framework provides the following features:

l        



Separtion of application
tasks(input logic, business logic and UI logic), testability, and test-driven
development(TDD) by default. All core contracts in the MVC framework 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 can use any
unit-testing framework that is compatible with the .NET Framework.

l        



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 parameter serialization, and other
components. You can plug in your own view engine, URL routing policy,
action-method parameter 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 allows you to inject objects into a class ,
instead of relying on the class to create the object it self. IOC specifies
that if an object requires another object, the first objects should get the
second object from an outside source such as a configuration file. This makes
testing easier.

l        



A powerful URL-mapping
component that lets you build applications that have comprehensible and
searchable 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.

l        



Support for using the markup in
existing ASP.NET page (.aspx files), user control(.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 expression(<%=%>),declarative server controls,
templates,data-bingding, localization, and so on.

l        



Support for existing ASP.NET
features. ASP.NET MVC lets you use features such as forms authentication and
Window authentication, URL authorization, membership and roles, output and data
caching, session and profile state management, health monitoring, the configuration
system, and the provider architecture.

 

 

参考:
MSDN MVC
部分

抱歉!评论已关闭.