The model layer of MVC I understand that there is no difference between the Molde of the three-tier architecture, which serves as a bridge between the various layers of data communication. But there are some features that are different from the traditional webform about control and view.
Here you learn the syntax of razor used in view.
In MVC there are two ways to render the view, the traditional webform and the new razor.
In the ASP. MVC4.0 Advanced Programming book, the advantages of razor are as follows.
1) more concise, expressive and flexible.
2) Not a new language (I've been struggling to find razor grammar rules until someone told me to just enter @ to start writing code.) )
3) Easy to learn input @ In some HTML code can
4) Support all text editors
5) IntelliSense function
MVC Features:
1. Simplify data validation with a validation model.
2. Non-intrusive JavaScript, meaning to not write JavaScript directly on the page, through auxiliary classes Ajax.actionlink and Ajax.begionfrom. Feel Webfrom write a JavaScript tag referring to JS as well.
3.JSON binding, this may be very interesting to me, the jsonvalueproviderfactory added in MVC3.0 support JSON binding.
4. Dependency resolution
It involves the design pattern of the dependent Jurassic injection, which has not been thoroughly understood so far. Dependency Injection Source Baidu Encyclopedia
Controller (registration and injection controller factory, injection controller)
Views (registering and injecting the view engine, injecting dependencies to the view page)
Operation Filters (locating and injecting filters)
Model binders (registration and injection)
Model validation provider (registration and injection)
Model meta-data provider (registration and injection)
Value provider (registration and injection)
5. Global Action Filter
| filter type |
interface |
description |
authorization |
iauthorizationfilter |
this type (or filter) is used to restrict a behavior method that enters a controller or controller |
exception |
iexceptionfilter |
|
action |
iactionfilter |
| before or after entering the behavior
Result |
Iresultfilter |
Used to return the previous or subsequent processing of the result |
The filter for an ASP. MVC2.0 operation can provide a hook for executing code that allows the code to run before or after an action method execution, which can be implemented with custom attributes that can be applied to some operations of the controller or the entire controller.
ASP. MVC3.0 extends this functionality, which is especially useful for handling application infrastructure issues such as error handling and logging.
I interpret this as an event within the life cycle of WebForm, Pageload Init, and so on.
6.mvc4.0 new Features
1) ASP. NET Web API similar to WCF services
2) Enhanced default project template
3) added a mobile project template using Jquery Mobile
4) Support display mode (displays Models)
5) Tasks that support asynchronous controllers
6) Bundle and micro (minification)
The purpose of designing ASP. NET MVC is to create a Web site, so the whole platform is designed to respond to browser requests and return HTML.
Web API source and MVC, here are some of its features that apply only to the HTTP service domain:
1) routing
2) model binding and validation
3) Filter
4) Base Frame
5) Simple Unit test
6) HTTP programming model
7) Action scheduling based on HTTP verbs
8) Content Negotiation
9) code-based configuration
In the face of Web APIs and WCF, it should be done on demand, after all, WCF is more comprehensive, but more complex.
MVC Learning (ii) Razor grammar